acm - another configuration module is a configuration reader. it can retrieve
values from command line arguments, environment variables, and local files of
different formats.
just requireing acm will return an instantiated Configuration object that
uses some pretty standard defaults. this is a function you can use
to get your configuration. the funciton object will also have a .set method
you can use to update values (in memory) and a .ref property which is the
actual Configuration instance. running config('github.username') will
result in the following checks:
- a
--github.usernamecommand line argument will be checked - a
GITHUB_USERNAMEenvironment variable will be checked - a file named
github.{json,json5,yaml,yml,ini}will be checked and parsed for the value
acm will make sensible decisions about where to check for configuration. for
example, when checking for:
- arguments: defaults to
process.argv - environment variables: defaults to
process.env - files: defaults to
$PWD/config/then$PWD
available extensions are: .ini, .json/.json5, and .yaml/.yml.
parsers for each of these extensions are located in acm.prototype.parsers.
adding new properties to this object will add support for addition file
extension. property values should be functions that take a string, parse it,
and return an object.
files can use merge fields. lodash's
template function is used to merge data into
string, and acm.prototype.fields is passed as the data argument. by default
.fields comes with a reference to process and process.env (labeled as
env)