node package manager

Introducing npm Enterprise add-ons. Integrate third-party dev tools into npm…


an nconf wrapper around conf/env.js & env.json

npm install -g envi
☁  bin [master] ⚡ envi 
Created your conf directory with env.js and env.json!
Install latest version of nconf? y or n [y]

You need configuration vars that are enviromentally specific. You also want them to use nconf goodness ( You want the environment to default to being development if process.env.NODE_ENV is undefined.

Running envi will give you a conf directory that looks like this:


So you can do this in your code:

env = require('./conf/env');
console.log(env.hello); //outputs I'm dev by default, otherwise reads process.env.NODE_ENV

Where env.json looks like:

    "hello": "I'm dev"
  , "test": {
    "hello": "I'm test"
  , "staging": {
    "hello": "I'm staging"
  , "production": {
    "hello": "I'm production"

Or, leverage nconf coolness:

node myprogram.js --hello "I've been overridden"