How to use the nconf.remove 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 KRMAssociatesInc / eHMP / ehmp / product / production / osync / worker-config.js View on Github external
function reloadConfig() {
    var newconfig;
    nconf.remove('conf');
    nconf.add('conf', {type:'file', file: './worker-config.json'});
    newconfig = nconf.get('osync');
    var refreshTime = config.configRefresh;
    var vistaSitesChanged = false;
    // console.log('refreshing config');
    //if file refresh changed, redo the file polling
    if(newconfig.configRefresh !== config.configRefresh) {
        clearInterval(reloadTimer);
        reloadTimer = setInterval(reloadConfig, newconfig.configRefresh);
    }
    if( JSON.stringify(newconfig.vistaSites) !== JSON.stringify(config.vistaSites) ) {
        vistaSitesChanged = true;
    }
    //update configuration with new settings
    var newConfigString = JSON.stringify(newconfig);
    if(cachedConfig !== newConfigString) {
github skygragon / leetcode-cli / lib / config.js View on Github external
Config.prototype.init = function() {
  nconf.file('local', file.configFile())
    .add('global', {type: 'literal', store: DEFAULT_CONFIG})
    .defaults({});

  const cfg = nconf.get();
  nconf.remove('local');
  nconf.remove('global');

  // HACK: remove old style configs
  for (let x in cfg) {
    if (x === x.toUpperCase()) delete cfg[x];
  }
  delete DEFAULT_CONFIG.type;
  delete cfg.type;

  _.extendOwn(this, cfg);
};
github muffinista / before-dawn / src / lib / savers.js View on Github external
// check if we just created the folder,
      // if there's no config yet,
      // or if the savers folder was empty
      if ( made === true || ! fs.existsSync(configPath) || fs.readdirSync(saversDir).length === 0 ) {
        _firstLoad = true;
        results.first = true;
      }

      try {
        nconf.remove("file").file({
          file: configPath
        });
      }
      catch(e) {
        fs.unlinkSync(configPath);
        nconf.remove("file").file({
          file: configPath
        });
      }   

      ensureDefaults();
      
      if ( _firstLoad === true ) {
        writeSync();
      }
      else if ( typeof(load_savers) === "undefined" || load_savers === true ) {
        results.setup = true;
      }

      resolve(results);
    });
  });
github skygragon / leetcode-cli / lib / config.js View on Github external
Config.prototype.init = function() {
  nconf.file('local', file.configFile())
    .add('global', {type: 'literal', store: DEFAULT_CONFIG})
    .defaults({});

  const cfg = nconf.get();
  nconf.remove('local');
  nconf.remove('global');

  // HACK: remove old style configs
  for (let x in cfg) {
    if (x === x.toUpperCase()) delete cfg[x];
  }
  delete DEFAULT_CONFIG.type;
  delete cfg.type;

  _.extendOwn(this, cfg);
};
github NodeBB / NodeBB / loader.js View on Github external
Loader.restart = function () {
	killWorkers();

	nconf.remove('file');
	nconf.use('file', { file: pathToConfig });

	fs.readFile(pathToConfig, { encoding: 'utf-8' }, function (err, configFile) {
		if (err) {
			console.error('Error reading config');
			throw err;
		}

		var conf = JSON.parse(configFile);

		nconf.stores.env.readOnly = false;
		nconf.set('url', conf.url);
		nconf.stores.env.readOnly = true;

		if (process.env.url !== conf.url) {
			process.env.url = conf.url;
github TWtablero / tablero / lib / configurable.js View on Github external
var remove = function (key) {
  nconf.remove(key);
};

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