Multi tier configuration loader as a package

Multi tier configuration loader as a package
The conf package reads configurations options in an overriding fashion from a number of sources. In order of importance:
1. System level overrides
2. Command line arguments
3. Environment variables
4. A configuration file(s)
5. Data loaded from an ETCD2 backend if specified
6. System specified defaults
conf/lib/overrides.js and should be reserved for static run time properties. Conf serves as a central place to get that information. For example, the full path to the packages directory is resolved at run time and loaded in to the conf loader. It won't / can't change during run time, but may change in the future. By getting the information from conf, application logic does not need to change between restarts or releases.
If overrides need to be change or added the overrides.js file must be changed
: spearator between keys. For example, using the flag: --foo:bar=1, would create an object like``js`
{
"foo":{
"bar": 1
}
}
's very well, so the double underscore ( __ ) is used in its place foo__bar=1 npm start`js
{
"foo":{
"bar": 1
}
}
`$3
The conf options can be set to read specific configuration from a file(s). The value should be a full path. If the path points to a directory, the conf loader will read all json files, sort them and load their values in an overriding order. Sorting is done in a descending, lexigraphical order.`sh
└── conf
├── 20-second.json
├── 10-first.json
└── 30-third.json
`Given the above directory of conf files, the server can be configured by pointing the
conf arguments at the directory`sh
node server --conf=$HOME/conf
`The configruation would be read in the following priority
` 10-first.json < 20-second.json < 30-third.json`where 20 overrides 10, and 30 overrides 20.
$3
defaults are what they sound like. Sane defaults for values that are needed to get the application running. They are located in conf/lib/defaults.js and are used only as fallback values.$3
Top level options can be aliased. Short hand aliases can be found and defined in the lib/shorthands.js module.Flag | Shorthand | Description
-----|:---------:|------------
PORT | p | Specifies the port the server will bind to
logger | l | specify the type(s) of logging transports for the server to use
the following invocations are treated the same
`sh
node server --PORT=3001 --logger=stdout --logger=file
`
`sh
PORT=3001 logger=stdout nodeserver -l file
`
`sh
node server -p 3001 -l stdout -l file
``