Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function loadConf() {
try {
nconf.load(function (err) {
if (err) {
logger.warn("Conf load error:" + err.message);
return;
}
});
} catch (err) {
// This will not catch the throw!
logger.error("Global conf load issue !");
logger.error(err);
return;
}
}
function getConf(){
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());
}
}
function readConfig(settingKey) {
nconf.load()
return nconf.get(settingKey)
}
export function configLoad() {
nconf.load();
}