0.1.10 • Published 9 years ago
conf-env v0.1.10
conf-env
Installation
$ npm install conf-env
API
var config = require('conf-env')();
var host = config.host;
var port = config.port;
config(options)
Create a env config helper with the given options
.
The default config file path is process.cwd()/config/env/
And generator have some file like: common.js development.js production.js test.js local.js etc.
Examples
how to switch config file
If you config the env variable NODE_ENV=development,then config will use development.js and merge with common.js
On Linux
export NODE_ENV=development
Or
export NODE_ENV=production
how to get the config value by key
var config = require('conf-env')();
var host = config.host;
var port = config.port;
custom local.js
If you add local.js in the ~/config/env/ path ,then local config will override env config.
demo
See demo conf-env-demo