Config module for node
$ npm install nconfig
var path = ;var options ="path": path;;var nconfig = options;var config = nconfig;console;
path (string) — Sets the directory path of the configuration files.
Loads the configuration file synchronously.
Config files should be in JSON format with a
// development.json"name": "My App""db":"host": "localhost""user": "root""pass": "abc123"
mergeWithEnv parameter was specified, nconfig will load and merge config files based on the following rules:
["production", "beta", "testing", "development"]with "beta" as target will not load "production"; "beta" will have the highest priority; "development" will have the lowest priority)
mergeWithEnv, that config will be loaded with lowest priority and will be overwritten by the target environment's config.
mergeWithEnvarray, it will follow the same logic as above with the target environment's config having the highest priority. All of the configs listed in the array will be loaded.
MIT License. Read the LICENSE file.
In summary, you can do whatever you want with the code but if it breaks, sorry :(
If you find bugs or think some parts can be improved, please post the request on GitHub.
If you want to fix it yourself, kudos! Fork the repo, do your magic, and invoke a pull request. I'll be sure to thank you and add you here as a contributor.