How to use envfile - 10 common examples

To help you get started, we’ve selected a few envfile 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 hernanjkd / Resume-Builder / deploy-to-github.js View on Github external
Console.help(`Check your remote by doing:
$ git remote get-url origin

Add your remote by doing:
$ git remote add origin 
`);
return;
}
Console.info("The remote was found successfully, starting the deploy from here: "+origin);

//get the repository project name
const repository = gh(origin);

// update the env file
const envPath = './.env';
const env = envfile.parseFileSync(envPath);
env['BASENAME'] = `/${repository["name"]}/`;
Console.info("Updating the .env file with the basename "+repository["name"]);
fs.writeFileSync(envPath, envfile.stringifySync(env));

const compiler = webpack(require(path.resolve(__dirname, 'webpack.prod.js')));
compiler.run((err, stats) => {
    if (err || stats.hasErrors()) {
      console.log(stats.toString({
        colors: true
      }));
      Console.error("There was an error compiling, review above");
      return;
    }
    Console.success("Your code compiled successfully, proceding to deploy...");
    ghpages.publish('public', function(err) {
        if(err){
github hernanjkd / Resume-Builder / deploy-to-github.js View on Github external
Add your remote by doing:
$ git remote add origin 
`);
return;
}
Console.info("The remote was found successfully, starting the deploy from here: "+origin);

//get the repository project name
const repository = gh(origin);

// update the env file
const envPath = './.env';
const env = envfile.parseFileSync(envPath);
env['BASENAME'] = `/${repository["name"]}/`;
Console.info("Updating the .env file with the basename "+repository["name"]);
fs.writeFileSync(envPath, envfile.stringifySync(env));

const compiler = webpack(require(path.resolve(__dirname, 'webpack.prod.js')));
compiler.run((err, stats) => {
    if (err || stats.hasErrors()) {
      console.log(stats.toString({
        colors: true
      }));
      Console.error("There was an error compiling, review above");
      return;
    }
    Console.success("Your code compiled successfully, proceding to deploy...");
    ghpages.publish('public', function(err) {
        if(err){
            console.error(err);
            Console.error("There was an error publishing your website");
            return;
github ArkEcosystem / core / packages / core-container / src / environment.ts View on Github external
private exportVariables() {
        process.env.CORE_TOKEN = this.variables.token;

        // Don't pollute the test environment!
        if (process.env.NODE_ENV === "test") {
            return;
        }

        const envPath = expandHomeDir(`${process.env.CORE_PATH_CONFIG}/.env`);

        if (existsSync(envPath)) {
            this.merge(envfile.parseFileSync(envPath));
        }
    }
}
github tessel / t2-cli / lib / tessel-ssh.js View on Github external
var Client = require('ssh2').Client
  , envfile = require('envfile')
  , config = envfile.parseFileSync(__dirname + '/../config.env')
  ;

function createConnection(callback) {
  // Create a new SSH client connection object
  var conn = new Client()
  // Open up an SSH Connection
  conn.on('ready', function() {
    callback && callback(null, conn);
  })
  conn.on('error', function(err) {
    callback && callback(err);
  }).connect({
    host: config.host,
    port: 22,
    username: config.username,
    privateKey: require('fs').readFileSync(config.keyPath)
github bloom510 / faunadb-nodejs-examples / internals / scripts / utils / env / index.js View on Github external
const fs = require("fs");
const { spawn } = require("child_process");
const { createKey }= require('../fdb');
const envfile = require("envfile");
const appRoot = require("app-root-path");
const envPath = appRoot + "/.env";
const env = envfile.parseFileSync(envPath);

const checkEnv = () => {
  if (!env) {
    fs.writeFileSync(envPath);
  }
};

const writeToEnv = params => {
 /* Write to env */
};

module.exports = { checkEnv, writeToEnv };
github keystonejs / keystone / cypress / scripts / utils.js View on Github external
// Load the required env vars
  let required = dotEnv.parse(fs.readFileSync(`${directory}/.env.example`));

  // Inject the prefix onto the keys
  required = Object.keys(required).reduce(
    (memo, requiredKey) =>
      Object.assign(memo, {
        [`${ciEnvPrefix}${requiredKey}`]: required[requiredKey],
      }),
    {}
  );

  // write back to a temporary file
  const tmpobj = tmp.fileSync();
  fs.writeFileSync(tmpobj.fd, envfile.stringifySync(required));

  // Use that temporary file as the 'expected env' vars
  const envVars = dotEnvSafe.config({
    example: tmpobj.name,
  });

  if (envVars.error) {
    // TODO: Better error with info on how to set the correct env vars
    throw new Error(envVars.error);
  }

  // The loaded env vars with the prefix removed
  const loadedEnvVars = Object.keys(envVars.parsed)
    .filter(key => key.startsWith(ciEnvPrefix))
    .reduce(
      (memo, key) =>
github alphagov / pay-selfservice / test / test_helpers / test_env.js View on Github external
'use strict'
const path = require('path')
const envfile = require('envfile')

const TEST_ENV = envfile.parseFileSync(path.join(__dirname, '../test.env'))

for (let property in TEST_ENV) {
  process.env[property] = TEST_ENV[property]
}
github blockapps / blockapps-rest / lib / util / oauth.client.js View on Github external
AAOCAQEATafWoYdQmUxiIsXitgHMV51f15KOWS6vsa+XfKPLFRFIbw8bYl/PdbJp
XoxywIf9rz7/+Hme6JXhIIao26ahXWG34J06CJ3kvnQcFzrUJ4AZLZrs3E0yzsNK
4zgdiPRK3TVCwzqnA6OkajLPuhisheAtoB2T5pR+SeC064cB3lhSgnFS31ePGmgv
b4qiXqr2JW4Db8yW0eKYrfwhf9WoElVlgO1ogqZS+ygeKYFfoNhQ5wQ+c43jDK5G
EDxFZuwghztIpmp2ItFOIxpsiZnEVlHNsq4H6YcZg4XENKhb9/lgIFiYADDbAEcq
pBMYLinJZN+jM/Xddr18fL0obdkk5Q==
-----END CERTIFICATE-----`;

if (!fs.existsSync(envPath)) {
  fs.appendFileSync(envPath, "", function(err) {
    if (err) throw err;
    console.log(".env file is created successfully.");
  });
}

envConfig = envfile.parseFileSync(envPath);

const flows = {
  authorizationCode: "authorization-code",
  clientCredential: "client-credential",
  resourceOwnerPasswordCredential: "resource-owner-password-credential"
};

commander
  .option("-c, --config [path]", "Config file", "config.yaml")
  .option(
    "-p, --port [number]",
    "Port on which to run web server for token exchange",
    "8000"
  )
  .option(
    "-f, --flow [oauth-flow]",
github MobileTribe / panda-lab / agent / scripts / genEnv.js View on Github external
const envfile = require('envfile');

const config = require("../../.config/config.json");

const apiKey = config.apiKey;
const authDomain = config.authDomain;
const projectId = config.projectId;
const databaseUrl = config.databaseUrl;
const messagingSenderId = config.messagingSenderId;
const storageBucket = config.storageBucket;
const apiUrl = config.apiUrl;
const authProviders = config.authProviders;

const env = envfile.stringifySync({
    VUE_APP_API_KEY: apiKey,
    VUE_APP_AUTH_DOMAIN: authDomain,
    VUE_APP_PROJECT_ID: projectId,
    VUE_APP_DATABASE_URL: databaseUrl,
    VUE_APP_MESSAGING_SENDER_ID: messagingSenderId,
    VUE_APP_STORAGE_BUCKET: storageBucket,
    VUE_APP_API_URL: apiUrl,
    VUE_APP_AUTH_PROVIDERS: authProviders
});

const fs = require('fs');

fs.writeFile(__dirname + "/../.env", env, function(err) {
    if(err) {
        return console.log(err);
    }
github stefanvanherwijnen / quasar-auth-starter / backend / console / configure.js View on Github external
sk.generate().then(() => {
      let b64 = sk.encode() 
      env.PASETO_KEY = b64
      let output = envfile.stringifySync(env)
      fs.writeFileSync(sourcePath, output)
      console.log('New PASETO key has been sucessfully generated.')
    });
  } catch (err) {

envfile

Parse and stringify the environment configuration files and format, also known as .env files and dotenv files

Artistic-2.0
Latest version published 11 months ago

Package Health Score

71 / 100
Full package analysis