Files
npm/node_modules/npmconf
isaacs 9a944cf82c npmconf: Upgrade for new SSL keys
In 6 months or so, or probably whenever 0.12 releases, we can
switch over to use the same SSL cert and key for the registry
as the npmjs.org website, and people can stop complaining about
the registry not rendering in their web browser.
2013-06-07 15:06:36 -07:00
..
2012-08-30 13:25:52 -07:00
2012-08-14 19:47:40 -07:00
2012-09-12 20:22:54 -07:00
2012-08-30 13:25:52 -07:00
2013-06-07 15:06:36 -07:00
2012-08-14 19:47:40 -07:00

npmconf

The config thing npm uses

If you are interested in interacting with the config settings that npm uses, then use this module.

However, if you are writing a new Node.js program, and want configuration functionality similar to what npm has, but for your own thing, then I'd recommend using rc, which is probably what you want.

If I were to do it all over again, that's what I'd do for npm. But, alas, there are many systems depending on many of the particulars of npm's configuration setup, so it's not worth the cost of changing.

USAGE

var npmconf = require('npmconf')

// pass in the cli options that you read from the cli
// or whatever top-level configs you want npm to use for now.
npmconf.load({some:'configs'}, function (er, conf) {
  // do stuff with conf
  conf.get('some', 'cli') // 'configs'
  conf.get('username') // 'joebobwhatevers'
  conf.set('foo', 'bar', 'user')
  conf.save('user', function (er) {
    // foo = bar is now saved to ~/.npmrc or wherever
  })
})