How to use dotenv-defaults - 6 common examples

To help you get started, we’ve selected a few dotenv-defaults examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mrsteele / dotenv-webpack / src / index.js View on Github external
getEnvs () {
    const { path, silent, safe } = this.config

    const env = dotenv.parse(this.loadFile({
      file: path,
      silent
    }), this.getDefaults())

    let blueprint = env
    if (safe) {
      let file = './.env.example'
      if (safe !== true) {
        file = safe
      }
      blueprint = dotenv.parse(this.loadFile({
        file,
        silent
      }))
    }
github mrsteele / dotenv-webpack / src / index.js View on Github external
getEnvs () {
    const { path, silent, safe } = this.config

    const env = dotenv.parse(this.loadFile({
      file: path,
      silent
    }), this.getDefaults())

    let blueprint = env
    if (safe) {
      let file = './.env.example'
      if (safe !== true) {
        file = safe
      }
      blueprint = dotenv.parse(this.loadFile({
        file,
        silent
      }))
    }

    return {
      env,
      blueprint
    }
  }
github pastelsky / bundlephobia / utils / server.utils.js View on Github external
require('dotenv-defaults').config()
const semver = require('semver')
const axios = require('axios')
const fetch = require('node-fetch')
const pacote = require('pacote')
const Queue = require('../server/Queue')

const CustomError = require('../server/CustomError')
/**
 * Given a package string
 * this function resolves to a valid version and name.
 */
async function resolvePackage(packageString) {

  try {
    return await pacote.manifest(packageString, { 'full-metadata': true })
  } catch (err) {
github pastelsky / bundlephobia / utils / cache.utils.js View on Github external
require('dotenv-defaults').config()
const debug = require('debug')('bp:cache')
const axios = require('axios')
const logger = require('../server/Logger')

const API = axios.create({
  baseURL: process.env.CACHE_SERVICE_ENDPOINT,
  timeout: 5000,
});

class Cache {
  async getPackageSize({ name, version }) {
    debug('get package %s@%s', name, version)
    try {
      const result = await API.get('/package-cache', { params: { name, version } })
      debug('cache hit')
      return result.data
github pastelsky / bundlephobia / cache-service / index.js View on Github external
require('dotenv-defaults').config()
const firebase = require('firebase')
const LRU = require('lru-cache')
const debug = require('debug')('bp:cache')
const fastify = require('fastify')()
const { getPackageSizeMiddlware, postPackageSizeMiddlware } = require('./middlewares/package-size.middleware')
const { getExportsSizeMiddlware, postExportsSizeMiddleware } = require('./middlewares/exports-size.middleware')


const firebaseConfig = {
  apiKey: process.env.FIREBASE_API_KEY,
  authDomain: process.env.FIREBASE_AUTH_DOMAIN,
  databaseURL: process.env.FIREBASE_DATABASE_URL,
}

firebase.initializeApp(firebaseConfig)
github pastelsky / bundlephobia / utils / rebuild.utils.js View on Github external
const { blackList } = require("../server/config");

require('dotenv-defaults').config()
const firebase = require('firebase')
const axios = require('axios')
const fetch = require('node-fetch')
const fs = require('fs')
const path = require('path')
const Queue = require('promise-queue-plus')
const debug = require('debug')('rebuild:script')
const debugWarning = require('debug')('rebuild:warning')
const got = require('got')
const gitURLParse = require('git-url-parse')
const { resolvePackage } = require("./server.utils");
const { parsePackageString } = require("./common.utils");
const deepEqual = require('lodash.isequal')
const childProcess = require('child_process')
const mkdir = require('mkdir-promise')

dotenv-defaults

dotenv... but with defaults!

MIT
Latest version published 2 years ago

Package Health Score

65 / 100
Full package analysis

Popular dotenv-defaults functions