2.2.1 • Published 7 years ago

mconfig v2.2.1

Weekly downloads
3
License
MIT
Repository
github
Last release
7 years ago

MConfig Build Status

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 = require('mconfig');
var config = mconfig('.log.conf.js');
console.log(config('LOG_PATH'));						// print '/log/error/'

console.log(mconfig('.log.conf.js', 'LOG_PATH2'));		// print '/log/warn/'

console.log(mconfig.defaults('LOG_PATH3'));				// 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.

2.2.1

7 years ago

2.2.0

7 years ago

2.1.0

8 years ago

2.0.4

8 years ago

2.0.3

9 years ago

2.0.2

9 years ago

2.0.1

9 years ago

2.0.0

9 years ago

1.3.2

9 years ago

1.3.1

9 years ago

1.3.0

9 years ago

1.2.0

9 years ago

1.1.0

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago