Created
August 20, 2014 11:19
-
-
Save clarkdave/f31d92ca88d11ef5340c to your computer and use it in GitHub Desktop.
Load YAML config files using nconf (nodejs)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var nconf = require('nconf'); | |
var yaml = require('js-yaml'); | |
var app_config = __dirname + '../config/application.yml'; | |
// load cmd line args and environment vars | |
nconf.argv().env(); | |
// load a yaml file using a custom formatter | |
nconf.file({ | |
file: app_config, | |
format: { | |
parse: yaml.safeLoad, | |
stringify: yaml.safeDump, | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A++++++++ would use again. Thanks =]