How to use the nconf.save 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 indutny / vock / lib / vock / cli / main.js View on Github external
// 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) {
github itchio / itch / appsrc / util / config.js View on Github external
save: function () {
    nconf.save((err) => {
      if (err) {
        console.log(`Could not save config: ${err}`)
      }
    })
  },
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 DaVarga / slingxdcc / lib / downloadHandler.js View on Github external
}
                }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 muffinista / before-dawn / src / lib / savers.js View on Github external
var write = function(cb) {
  var configPath = baseDir + "/" + config_file;
  nconf.save(cb);
};
github PolarisChen / Piece / app / config.js View on Github external
function saveConfig(settingKey, settingValue) {
    nconf.set(settingKey, settingValue)
    nconf.save()
}
github splunk / splunkrepl / splunkrepl.js View on Github external
function cmd_save(cmd, callback) {
    nconf.save(function(err) {
        if (err != undefined) {
            callback(err);
        }
        callback("Configuration saved".yellow.bold);
    });
}
github polonel / trudesk / src / settings / defaults.js View on Github external
function (done) {
        nconf.save(done)
      },
      function (done) {

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