How to use the nconf.env function in nconf

To help you get started, we’ve selected a few nconf 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 wildbit / postmark.js / tests / fixture_generalClientTests.js View on Github external
var mocha = require('mocha');
var assert = require('assert');
var nconf = require('nconf');
var testingKeys = nconf.env().file({
    file: __dirname + '/../testing_keys.json'
});
var util = require('util');
var merge = require('merge');

var postmark = require('../lib/postmark/index.js');

describe('general client functionality', function() {
    // allow some of the more intensive tests to take longer.
    this.timeout(30000);
    var _client = null;

    beforeEach(function() {
        _client = new postmark.Client(testingKeys.get('WRITE_TEST_SERVER_TOKEN'));
    });
github wildbit / postmark.js / tests / fixture_postmarkClientSending.js View on Github external
'use strict';

var mocha = require('mocha');
var assert = require('assert');
var nconf = require('nconf');
var testingKeys = nconf.env().file({
  file: __dirname + '/../testing_keys.json'
});
var util = require('util');
var merge = require('merge');

var postmark = require('../lib/postmark/index.js');

describe('client email sending', function() {
  // allow some of the more intensive tests to take longer.
  this.timeout(30000);
  var _client = null;
  var testTemplateAlias = 'postmark-js-batch-testing template';

  beforeEach(function() {
    _client = new postmark.Client(testingKeys.get('WRITE_TEST_SERVER_TOKEN'));
    _client.deleteTemplate(testTemplateAlias);
github onehilltech / blueprint / packages / blueprint-gatekeeper / config / index.js View on Github external
var nconf   = require ('nconf')
  , path    = require ('path')
  , winston = require ('winston')
  ;

// Locate the correct configuration file.
var env = process.env.NODE_ENV || 'dev';
var configFile = path.join (__dirname, '../config', env + '.json');
winston.info ('configuration=' + configFile);

// Load the configuration file for the environment.
nconf.env ().file ({file: configFile}).argv ();

// Add the environment to the configuration.
nconf.set ('env', env);

exports = module.exports = nconf;
github MicrosoftWebMatrix / ExpressStarter / server.js View on Github external
var express = require('express')
  , less = require('less')
  , connect = require('connect')
  , everyauth = require('everyauth')
  , nconf = require('nconf')
  , Recaptcha = require('recaptcha').Recaptcha;


/**
* CONFIGURATION
* -------------------------------------------------------------------------------------------------
* load configuration settings from ENV, then settings.json.  Contains keys for OAuth logins. See 
* settings.example.json.  
**/
nconf.env().file({file: 'settings.json'});


/**
* EVERYAUTH AUTHENTICATION
* -------------------------------------------------------------------------------------------------
* allows users to log in and register using OAuth services
**/

everyauth.debug = true;

// Configure Facebook auth
var usersById = {},
    nextUserId = 0,
    usersByFacebookId = {},
    usersByTwitId = {},
    usersByLogin = {
github monaca / monaca-lib / src / localkit.js View on Github external
util = require('util'),
    events = require('events'),
    utils = require(path.join(__dirname, 'utils')),
    nconf = require('nconf');

  // local imports
  var ProjectEvents = require(path.join(__dirname, 'localkit', 'projectEvents')),
    Monaca = require(path.join(__dirname, 'monaca')),
    FileWatcher = require(path.join(__dirname, 'localkit', 'fileWatcher')),
    LocalAuth = require(path.join(__dirname, 'localkit', 'localAuth')),
    Api = require(path.join(__dirname, 'localkit', 'api')),
    broadcastAddresses = require(path.join(__dirname, 'localkit', 'broadcastAddresses')),
    inspector = require(path.join(__dirname, 'inspector'));

  // config
  var config = nconf.env()
    .file(path.join(__dirname, 'config.json'))
    .get('localkit');

  var PAIRING_KEYS_FILE = path.join(
    process.env[(process.platform == 'win32') ? 'USERPROFILE' : 'HOME'],
    '.cordova', 'monaca_pairing_keys.json'
  );

  /**
   * @class Localkit
   * @description
   *   Create localkit object.
   * @param {object} monaca - Monaca object.
   * @param {boolean} [verbose] - Will output log messages if true.
   * @example
   *   var monaca = new Monaca(),
github numenta / numenta-apps / unicorn / app / main / ConfigService.js View on Github external
function createConfigService() {
  const config = nconf.env().argv();

  // Global environment
  config.defaults(DEFAULT_CONFIG_FILE);

  /* eslint-disable no-process-env */
  if (process.env.NODE_ENV === 'development') {
    config.overrides(DEVELOPMENT_CONFIG_FILE);
  } else {
    config.overrides(PRODUCTION_CONFIG_FILE);
  }
  /* eslint-ensable no-process-env */

  // Set first file/store to user settings
  let location = path.join(CONFIG_PATH, 'user.settings.json');
  if (!isElectronRenderer) {
    try {
github wildbit / postmark.js / tests / fixture_clientServerHandling.js View on Github external
var mocha = require('mocha');
var assert = require('assert');
var nconf = require('nconf');
var testingKeys = nconf.env().file({
  file: __dirname + '/../testing_keys.json'
});
var util = require('util');
var merge = require('merge');

var postmark = require('../lib/postmark/index.js');

describe('client server handling', function() {
  this.timeout(10000);
  var _client = null;

  beforeEach(function() {
    _client = new postmark.Client(testingKeys.get('WRITE_TEST_SERVER_TOKEN'));
  });

  it("should retrieve current server", function(done) {
github stolksdorf / vitreum / test / app.js View on Github external
const config = require('nconf')
	.env({ lowerCase: true, separator: '.' })
	.argv()
	.file('environment', { file: `config/${process.env.NODE_ENV}.json` })
	.file('defaults', { file: 'config/default.json' });

const server = require('./server/server.js');

const PORT = config.get('port');
server.listen(PORT, () => {
	console.log(`server on port:${PORT}`);
});
github aprnd / asset-server / modules / config.js View on Github external
var nconf = require('nconf');

var filename = 'config.'+ (nconf.env().get("AssetServerEnv") || "local") +'.json';

nconf.file({ file: filename });
module.exports = nconf.get('config');
github jkingyens / b2d-sync / watch.js View on Github external
var async = require('async');
var chokidar = require('chokidar');
var osenv = require('osenv');
var cp = require('child_process');
var nconf = require('nconf');
var debounce = require('async-debounce');

var docker_ip;

nconf.env().argv().file('bdsync.json');

nconf.defaults({
  'targetPath': process.cwd(),
  'ignoreFile' : '.gitignore'
});

function getdockerip (cb) {
  cp.exec('boot2docker ip 2>/dev/null', function (err, stdout) {
    if (err) {
      return cb(err);
    }
    docker_ip = stdout.trim();
    cb();
  });
}

nconf

Hierarchical node.js configuration with files, environment variables, command-line arguments, and atomic object merging.

MIT
Latest version published 6 months ago

Package Health Score

82 / 100
Full package analysis