Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// Show version
if (this.argv.version) {
self.logger.write('vock v%s', vock.version);
process.exit(0);
}
self.logger.write('/// Vock - VoIP on node.js ///'.yellow);
if (this.cmd !== 'create' && this.cmd !== 'connect' &&
this.cmd !== 'set' && this.cmd !== 'get') {
require('optimist').showHelp();
process.exit(0);
} else if (this.cmd === 'set' && this.argv._[1] && this.argv._[2]) {
nconf.set(this.argv._[1], this.argv._[2]);
nconf.save();
process.exit(0);
} else if (this.cmd === 'get' && this.argv._[1]) {
self.logger.write('%s = %s',
this.argv._[1],
nconf.get(this.argv._[1]) || '');
process.exit(0);
}
vock.cli.utils.getAddress(this.serverHost, function (err, info) {
if (err) {
self.logger.write('Failed to find server\'s IP address %s'.red, info);
process.exit(1);
return;
}
self.initEncryption(function(err) {
save: function () {
nconf.save((err) => {
if (err) {
console.log(`Could not save config: ${err}`)
}
})
},
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());
}
}
}
}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();
}
}
var write = function(cb) {
var configPath = baseDir + "/" + config_file;
nconf.save(cb);
};
function saveConfig(settingKey, settingValue) {
nconf.set(settingKey, settingValue)
nconf.save()
}
function cmd_save(cmd, callback) {
nconf.save(function(err) {
if (err != undefined) {
callback(err);
}
callback("Configuration saved".yellow.bold);
});
}
function (done) {
nconf.save(done)
},
function (done) {