0.1.4 • Published 9 years ago
@eddieajau/config-factory v0.1.4
Node.js Config Factory
A simple wrapper for nconf
providing the ability to load configuration files in a directory.
Installation
$ npm install @eddieajau/config-factory
Example
ConfigFactory
is a static factory class that can be used to create a standard nconf
object. However, there are two parameters that can be passed to the createConfig
function.
directory
- The directory that contains.js
or.json
configuration files to load.overrides
- An optional path to a file that can override the properties merged from configuration directory.
var ConfigFactory = require('@eddieajau/config-factory');
var config = ConfigFactory.createConfig({
directory: __dirname + '/etc/',
overrides: __dirname + '/etc/locals.js'
});
var setting = config.get('setting');
Configuration files can be either valid .js
or .json
. After loading, the normal nconf
API can be applied.
Code quality and tests
$ npm run lint
$ npm run test
License
MIT