Skip to content

Instantly share code, notes, and snippets.

@clarkdave
Created August 20, 2014 11:19
Show Gist options
  • Star 13 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save clarkdave/f31d92ca88d11ef5340c to your computer and use it in GitHub Desktop.
Save clarkdave/f31d92ca88d11ef5340c to your computer and use it in GitHub Desktop.
Load YAML config files using nconf (nodejs)
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,
}
});
@orthecreedence
Copy link

A++++++++ would use again. Thanks =]

@ernoaapa
Copy link

👍 Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment