How to use the nconf.set 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 Gravebot / Gravebot / tests / index.js View on Github external
import glob from 'glob';
import nconf from 'nconf';
import R from 'ramda';

import '../src/init-config';
import '../src/redis';
import startExpress from '../src/express';
import { init as initPhantom } from '../src/phantom';


// Defaults
startExpress();
initPhantom();
nconf.set('CLIENT_ID', '123');

const glob_options = {
  realpath: true,
  nodir: true
};

const test_files = R.flatten([
  glob.sync('./tests/*/*.js', glob_options),
  glob.sync('./tests/*(!(index.js))', glob_options)
]);

R.forEach(test_case => require(test_case), test_files);
github Azure / azure-sdk-for-node / examples / ASM / serviceexplorer / controllers / serviceController.js View on Github external
exports.setupPOST = function (request, response) {
  var showError = function (message) {
    // TODO: actually show the error message
    response.render('setup');
  };

  if (request.body.account &&
      request.body.accessKey &&
      request.body.WaRuntimeEndpoint) {

    nconf.set('AZURE_STORAGE_ACCOUNT', request.body.account);
    nconf.set('AZURE_STORAGE_ACCESS_KEY', request.body.accessKey);
    nconf.set('WaRuntimeEndpoint', request.body.WaRuntimeEndpoint);

    nconf.save(function (error) {
      if (error) {
        showError(error);
      } else {
        response.redirect('/');
      }
    });
  } else {
    showError();
  }
};
github NodeBB / NodeBB / test / mocks / databasemock.js View on Github external
nconf.file({ file: path.join(__dirname, '../../config.json') });
nconf.defaults({
	base_dir: path.join(__dirname, '../..'),
	themes_path: path.join(__dirname, '../../node_modules'),
	upload_path: 'test/uploads',
	views_dir: path.join(__dirname, '../../build/public/templates'),
	relative_path: '',
});

const urlObject = url.parse(nconf.get('url'));
const relativePath = urlObject.pathname !== '/' ? urlObject.pathname : '';
nconf.set('relative_path', relativePath);

if (!nconf.get('isCluster')) {
	nconf.set('isPrimary', 'true');
	nconf.set('isCluster', 'true');
}

const dbType = nconf.get('database');
const testDbConfig = nconf.get('test_database');
const productionDbConfig = nconf.get(dbType);

if (!testDbConfig) {
	const errorText = 'test_database is not defined';
	winston.info(
		'\n===========================================================\n' +
		'Please, add parameters for test database in config.json\n' +
		'For example (redis):\n' +
		'"test_database": {\n' +
		'    "host": "127.0.0.1",\n' +
		'    "port": "6379",\n' +
github DaVarga / slingxdcc / lib / downloadHandler.js View on Github external
createRequest(dlQueues[packObj.server][packObj.nick][0]);
                    }
                }else{
                    self.emit("dequeuePending#"+packObj.server+"#"+packObj.nick+"#"+packObj.nr);
                }
            } else {
                dlQueues[packObj.server][packObj.nick].splice(index, 1);
            }


            if (dlQueues[packObj.server][packObj.nick].length == 0)
                delete dlQueues[packObj.server][packObj.nick];
            if (Object.keys(dlQueues[packObj.server]).length == 0)
                delete dlQueues[packObj.server];

            nconf.set('downloads', dlQueues);
            nconf.save();
        }


    }
github noahehall / theBookOfNoah / web_apps / node / config / index.js View on Github external
import nconf from 'nconf';
import fse from 'fs-extra';
import process from './process';
import path from 'path';

nconf.use('memory')
  .argv({
    /*
      inspect: {default: undefined},
    */
  })
  .env(['NODE_ENV']);

nconf.set('NODE_ENV', nconf.get('NODE_ENV') || 'development')
nconf.set('port', nconf.get('port') || 8080);
nconf.set('domain', nconf.get('domain') || 'localhost');
nconf.set('output', nconf.get('path') || path.resolve(__dirname, '..','build/public/'))
nconf.set('jspath', nconf.get('jspath') || 'js')
nconf.set('htmlpath', nconf.get('htmlpath') || 'html')
nconf.set('imagepath', nconf.get('imagepath') || 'images')
nconf.set('protocol', nconf.get('protocol') || 'http');
nconf.set('publicPath', nconf.get('publicPath') || '/');

fse.outputJson(
  'config.json',
  nconf.get(),
  function cb(err, data) {
    if (err) console.error('config/index',err);
    console.log('return process')
    return process(nconf);
  }
)
github noahehall / theBookOfNoah / node / config / index.js View on Github external
import fse from 'fs-extra';
import process from './process';
import path from 'path';

nconf.use('memory')
  .argv({
    /*
      inspect: {default: undefined},
    */
  })
  .env(['NODE_ENV']);

nconf.set('NODE_ENV', nconf.get('NODE_ENV') || 'development')
nconf.set('port', nconf.get('port') || 8080);
nconf.set('domain', nconf.get('domain') || 'localhost');
nconf.set('output', nconf.get('path') || path.resolve(__dirname, '..','build/public/'))
nconf.set('jspath', nconf.get('jspath') || 'js')
nconf.set('htmlpath', nconf.get('htmlpath') || 'html')
nconf.set('imagepath', nconf.get('imagepath') || 'images')
nconf.set('protocol', nconf.get('protocol') || 'http');
nconf.set('publicPath', nconf.get('publicPath') || '/');

fse.outputJson(
  'config.json',
  nconf.get(),
  function cb(err, data) {
    if (err) console.error('config/index',err);
    console.log('return process')
    return process(nconf);
  }
)
github experience-experiments / generate-pdf / lib / index.js View on Github external
const {
  getHoganFor
} = require('hogan-cache')

const htmlPdf = require('html-pdf')

const file = path.resolve(__dirname, 'config.json')

nconf
  .env()
  .argv()
  .file({ file })

let script = nconf.get('htmlPdf:script')
script = path.resolve(__dirname, script)
nconf.set('htmlPdf:script', script)

const executeMakeFace = (parameters) => (
  ('makeFace' in parameters)
    ? makeFace(parameters.makeFace.srcPath, parameters.makeFace.cssPath)
      .then(() => parameters)
   : parameters
)

const executeReadFace = (parameters) => (
  ('readFace' in parameters)
    ? readFace(parameters.readFace.path)
      .then((readFace) => ({ ...parameters, readFace }))
    : parameters
)

const executeHoganFor = (parameters) => (
github grafana-wizzy / wizzy / src / util / config.js View on Github external
Config.prototype.initialize = function initialize() {
  this.localfs.createDirIfNotExists(confDir, true);
  const configExists = this.localfs.checkExists(confFile, 'conf file', false);
  if (configExists) {
    logger.showResult('conf file already exists.');
  } else {
    nconf.set('config', {});
    this.saveConfig(false);
    logger.showResult('conf file created.');
  }
  logger.showResult('wizzy successfully initialized.');
};
github auth0 / ad-ldap-connector / node_modules / connector-setup / index.js View on Github external
function (cb) {
      nconf.set('PROVISIONING_TICKET', provisioningTicket);
      nconf.set('WSFED_ISSUER', info.connectionDomain);
      nconf.set('SITE_NAME', nconf.get('SITE_NAME') || info.connectionDomain);
      nconf.set(info.realm.name, info.realm.postTokenUrl);
      extraEmptyVars.forEach(function (ev) {
        if (!nconf.get(ev)) nconf.set(ev, '');
      });
      nconf.save(cb);
    },
    function (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