node package manager
Loosely couple your services. Use Orgs to version and reuse your code. Create a free org »

jus-config

jus-config

Jus-Config is a Node.JS module that will help you manager your configuration files, supporting multiple formats, and ability to load and merge multiple files over multiple directories.

Quick example

Suppose you want to make your app's port configurable. You'll have these two configuration files:

// "config/default.json" 
// This is the default options 
{ "host": "localhost"
, "port": 3000 }
 
// "config/prod.json" 
// This is, for example, your unversionned env-specific configuration 
{ "port": 80 }

Then you can load your configuration files this way:

var conf = require('jus-config')
  , express = require('express')
  , app = express.createServer()
 
// Load configuration from "config/default.json" and/or "config/prod.json" 
conf.load(['default', 'prod'], function(err, config) {
  // config = { "host": "localhost", "port": 80 } 
  app.listen(config.port, config.host)
})

Download and install

From npm

npm install jus-config

or add "jus-config" as a dependency in your package.json and call npm install.

From git

git clone the repository git@github.com:naholyr/node-jus-config.git in node_modules/jus-config. You're ready to go.

Documentation

Loading configuration

  • load - load configuration

Configure parsers

Debug mode

  • debug - enables/disables debug