How to use the nconf.clear 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 sockethub / sockethub / src / config.ts View on Github external
defaultEnvParams(
      process.env.HOST || nconf.get('service:host'),
      process.env.PORT || nconf.get('service:port'),
      'service'
    );

    defaultEnvParams(
      process.env.REDIS_HOST || nconf.get('redis:host'),
      process.env.REDIS_PORT || nconf.get('redis:port'),
      'redis'
    );

    // allow a redis://user:host:port url, takes precedence
    if (process.env.REDIS_URL) {
      nconf.set('redis:url', process.env.REDIS_URL);
      nconf.clear('redis:host');
      nconf.clear('redis:port');
    }
  }
  get = (key: string): any => nconf.get(key);
github skygragon / leetcode-cli / lib / commands / config.js View on Github external
// show all
  if (argv.key.length === 0)
    return log.info(prettyConfig(loadConfig(argv.all)));

  // sugar: notice user that use ':' instead of '.'
  if (argv.key.includes('.') && !argv.key.includes(':'))
    return log.printf('Key should use colon(:) as the delimiter, do you mean %s?',
      chalk.yellow(argv.key.replace(/\./g, ':')));

  const v = nconf.get(argv.key);

  // delete
  if (argv.delete) {
    if (v === undefined) return log.fatal('Key not found: ' + argv.key);
    nconf.clear(argv.key);
    return saveConfig();
  }

  // show
  if (argv.value.length === 0) {
    if (v === undefined) return log.fatal('Key not found: ' + argv.key);
    return log.info(prettyConfig(v));
  }

  // set
  try {
    nconf.set(argv.key, JSON.parse(argv.value));
  } catch (e) {
    nconf.set(argv.key, JSON.parse('"' + argv.value + '"'));
  }
  return saveConfig();
github Hypercubed / autocmdr / lib / config.js View on Github external
function _config (key, value) {
    if (key && value !== null) {
      if (value === '') {
        program.log.debug('Clearing key', key);
        nconf.clear(key);
      } else {
        program.log.debug('Setting key', key, 'to', value);
        nconf.set(key, value);
      }
      nconf.save();
      console.log(nconf.save());
    } else if (key) {
      program.log.debug('Retrieving key', key);
      console.log(nconf.get(key));
    } else {
      program.log.debug('Listing all kay-values');
      console.log(nconf.load());
    }
  }
github ziacik / lumus / config.js View on Github external
destinationDir : 'Shows',
		digitalAudioPreference : Preference.preferred,
		hdVideoPreference : Preference.preferred
	},
	musicSettings : {
		maxSize : 300,
		destinationDir : 'Music',
		losslessFormatPreference : Preference.optional
	},
});

var legacyHdVideoPreference1 = nconf.get('movieSettings:requireHD');

if (legacyHdVideoPreference1) {
	nconf.set('movieSettings:hdVideoPreference', legacyHdVideoPreference1);
	nconf.clear('movieSettings:requireHD');
}

var legacyHdVideoPreference2 = nconf.get('showSettings:requireHD');

if (legacyHdVideoPreference2) {
	nconf.set('showSettings:hdVideoPreference', legacyHdVideoPreference2);
	nconf.clear('showSettings:requireHD');
}

var legacyDigitalAudioPreference1 = nconf.get('movieSettings:requireDigitalSound');

if (legacyDigitalAudioPreference1) {
	nconf.set('movieSettings:digitalAudioPreference', legacyDigitalAudioPreference1);
	nconf.clear('movieSettings:requireDigitalSound');
}
github ziacik / lumus / config.js View on Github external
nconf.set('showSettings:hdVideoPreference', legacyHdVideoPreference2);
	nconf.clear('showSettings:requireHD');
}

var legacyDigitalAudioPreference1 = nconf.get('movieSettings:requireDigitalSound');

if (legacyDigitalAudioPreference1) {
	nconf.set('movieSettings:digitalAudioPreference', legacyDigitalAudioPreference1);
	nconf.clear('movieSettings:requireDigitalSound');
}

var legacyDigitalAudioPreference2 = nconf.get('showSettings:requireDigitalSound');

if (legacyDigitalAudioPreference2) {
	nconf.set('showSettings:digitalAudioPreference', legacyDigitalAudioPreference2);
	nconf.clear('showSettings:requireDigitalSound');
}

var legacyLosslessFormatPreference = nconf.get('musicSettings:requireLossless');

if (legacyLosslessFormatPreference) {
	nconf.set('musicSettings:losslessFormatPreference', legacyLosslessFormatPreference);
	nconf.clear('musicSettings:requireLossless');
}

if (legacyHdVideoPreference1 || legacyHdVideoPreference2 || legacyDigitalAudioPreference1 || legacyDigitalAudioPreference2 || legacyLosslessFormatPreference) {
	nconf.save();
}

labels.add({
	checkInterval : 'Check Interval [sec]',
	movieSettings : '<span class="fa fa-film"> Movies',</span>
github itchio / itch / appsrc / util / config.ts View on Github external
clear: function (key: string) {
    nconf.clear(key);
    self.save();
  },
};
github auth0 / ad-ldap-connector / connector-setup / index.js View on Github external
function (cb) {
      var password = nconf.get('LDAP_BIND_PASSWORD');
      if (password) {
        nconf.clear('LDAP_BIND_PASSWORD');
        nconf.set('LDAP_BIND_CREDENTIALS', crypto.encrypt(password));
      }
      cb();
    },
    function (cb) {
github ziacik / lumus / app / config.js View on Github external
nconf.set('showSettings:hdVideoPreference', legacyHdVideoPreference2);
	nconf.clear('showSettings:requireHD');
}

var legacyDigitalAudioPreference1 = nconf.get('movieSettings:requireDigitalSound');

if (legacyDigitalAudioPreference1) {
	nconf.set('movieSettings:digitalAudioPreference', legacyDigitalAudioPreference1);
	nconf.clear('movieSettings:requireDigitalSound');
}

var legacyDigitalAudioPreference2 = nconf.get('showSettings:requireDigitalSound');

if (legacyDigitalAudioPreference2) {
	nconf.set('showSettings:digitalAudioPreference', legacyDigitalAudioPreference2);
	nconf.clear('showSettings:requireDigitalSound');
}

var legacyLosslessFormatPreference = nconf.get('musicSettings:requireLossless');

if (legacyLosslessFormatPreference) {
	nconf.set('musicSettings:losslessFormatPreference', legacyLosslessFormatPreference);
	nconf.clear('musicSettings:requireLossless');
}

if (legacyHdVideoPreference1 || legacyHdVideoPreference2 || legacyDigitalAudioPreference1 || legacyDigitalAudioPreference2 || legacyLosslessFormatPreference) {
	nconf.save();
}

labels.add({
	checkInterval : 'Check Interval [sec]',
	movieSettings : '<span class="fa fa-film"> Movies',</span>
github itchio / itch / appsrcts / util / config.ts View on Github external
clear: function (key: string) {
    nconf.clear(key);
    self.save();
  },
};
github ziacik / lumus / app / config.js View on Github external
nconf.set('movieSettings:digitalAudioPreference', legacyDigitalAudioPreference1);
	nconf.clear('movieSettings:requireDigitalSound');
}

var legacyDigitalAudioPreference2 = nconf.get('showSettings:requireDigitalSound');

if (legacyDigitalAudioPreference2) {
	nconf.set('showSettings:digitalAudioPreference', legacyDigitalAudioPreference2);
	nconf.clear('showSettings:requireDigitalSound');
}

var legacyLosslessFormatPreference = nconf.get('musicSettings:requireLossless');

if (legacyLosslessFormatPreference) {
	nconf.set('musicSettings:losslessFormatPreference', legacyLosslessFormatPreference);
	nconf.clear('musicSettings:requireLossless');
}

if (legacyHdVideoPreference1 || legacyHdVideoPreference2 || legacyDigitalAudioPreference1 || legacyDigitalAudioPreference2 || legacyLosslessFormatPreference) {
	nconf.save();
}

labels.add({
	checkInterval : 'Check Interval [sec]',
	movieSettings : '<span class="fa fa-film"> Movies',
	maxSize : 'Max Size [MB]',
	digitalAudioPreference : 'Digital Audio',
	hdVideoPreference : 'HD Video',
	showSettings : '<span class="fa fa-tv"> Shows',
	musicSettings : '<span class="fa fa-music"> Music',
	losslessFormatPreference : 'Lossless Format',
	removeFinishedDays : 'Remove Finished Items After ? Days <small><em>0 is never</em></small>',</span></span></span>

nconf

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

MIT
Latest version published 1 year ago

Package Health Score

74 / 100
Full package analysis