code by Steven Enten

confectioner

Fork me on GitHub

Simpliest configuration builder which used the environment.

Installation

npm install confectioner --save

Example

// example.js

var confectioner = require('confectioner');

var config = confectioner({
    env: { envname: 'NODE_ENV', defaultValue: 'development' },
    hostname: { envname: 'MY_HOST', defaultValue: 'localhost' },
    port: { envname: 'MY_PORT', defaultValue: 1337, type: 'int' },
    baseuri: { envname: 'MY_BASEURI', defaultValue: '/myapp' }
});

console.log(config.getValuesMap());

// $ NODE_ENV=production MY_PORT=80 node --harmony example.js
// { env: 'production',
//   hostname: 'localhost',
//   port: '80',
//   baseuri: '/myapp' }

API

API documentation

Tests

npm test

Release History

  • 0.1.0 Initial release

Credits

License

MIT