configyour
Simple directory and file based configuration using json and yaml
Installation
$ npm install configyour
Usage
configyour will read the directory that you pass it and return an object containing the contents of
the .json
, .yml
, and .yaml
files, keyed the by filenames. Then it will go a single level down
the directory chain to a directory named the same as process.env.NODE_ENV
and override any existing
keys with those found in the envrionment-specific directory.
For example:
|- my-app
|- server.js
|- config/
| |- foo.json
| |- production/
| | |- foo.json
| |- development/
| | |- foo.json
| | |- debug.json
If your server.js file had the following line in it:
var config = __dirname + '/config';
In production, the output would be an object that looked like:
In development, the output would be an object that looked like:
And finally, in test, the output would be an object that looked like:
License
Copyright (c) 2013 Matt Insler Licensed under the MIT license.