MConfig
Simple to read config file for modules. Support mulit cwd.
Installation
$ npm install mconfig
Usage
$ mkdir config
$ vi config/.log.conf.js
module.exports = {
LOG_PATH: '/log/error/',
LOG_PATH2: '/log/warn/'
}
$ vi config/my.defaults.conf.js
module.exports = {
"LOG_PATH3": "/log/nolog/"
}
Read config file by MConfig
var mconfig = ;var config = ;console; // print '/log/error/' console; // print '/log/warn/' console; // print '/log/nolog/'
Notice
MConfig reads configuration files in the ./config
directory for the running process.
This can be overridden by running application width mconfig_cwd
argv or setting the $NODE_CONFIG_DIR
environment variable.
node app.js --mconfig_cwd=/home/user/etc/node_config/
Of course, you can also set mconfig module cwd
variable to change the directory.
Difference from config
This is similar to config but adds features.
Multiple profiles helps to reduce the inter-dependence. This is useful for function profile.