Skip to content
This repository

The Extended-JSON library allows you to transform JSON using plugins, and comes with several plugins that are very useful for app configuration. To get started add eson:

$ npm install eson --save

Then require eson and select a configuration file based on the NODE_ENV environment variable, defaulting to "development":

var express = require('express');
var app = express();
var eson = require('eson');
var file = __dirname + '/config/' + app.get('env') + '.json';

The file variable will then contain a path to ./config/development.json, ./config/production.json etcetera. Two plugins are used here, .env() to read config from environment variables, and .args() to read from ARGV.

var conf = eson()

Now if you had { "log path": "/tmp/app.log" } in development.json, you could override this with a MYAPP_LOG_PATH=/some/path environment variable, or with node app --log-path /some/path.

Something went wrong with that request. Please try again.