@eddieajau/config-factory

0.1.4 • Public • Published

Node.js Config Factory

Build Status

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

References

/@eddieajau/config-factory/

    Package Sidebar

    Install

    npm i @eddieajau/config-factory

    Weekly Downloads

    0

    Version

    0.1.4

    License

    MIT

    Last publish

    Collaborators

    • eddieajau