node package manager
Love JavaScript? Your insights can make it even better. Take the 2017 JavaScript Ecosystem Survey »


Build Status

nor-config -- Config library for Node.js

Warning! This code is experimental and in a state of preliminary development. Use at your own risk.


It's under MIT-style open source license -- see


You can install it simply from NPM:

npm install nor-config


App defaults can be configured in file ./config.json (or later in the source code with ._def()):

  "port": 8080

Local settings (overrides values in ./config.js) for the app can be set in ./local/config.json:

  "host": '',
  "port": 3000

The ./app.js uses it like this:

var config = require('nor-config').from(__dirname);
config._def('host', 'localhost');   // Set default value 
config._require('port');            // If port is missing, throws an exception. 
console.log( + ':' + config.port);

The output will be

The library will also read package.json if it exists, and saves contents from it to config.pkg.