Skip to content
/ acm Public

acm (another configuration module) is a configuration reader. It can retrieve values from command line arguments, environment variables, and local files of different formats.

Notifications You must be signed in to change notification settings

minond/acm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status Coverage Status

acm - another configuration module is a configuration reader. it can retrieve values from command line arguments, environment variables, and local files of different formats.

usage

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:

  1. a --github.username command line argument will be checked
  2. a GITHUB_USERNAME environment variable will be checked
  3. a file named github.{json,json5,yaml,yml,ini} will be checked and parsed for the value

defaults

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

file extension and parsers

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.

file merge fields

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)

About

acm (another configuration module) is a configuration reader. It can retrieve values from command line arguments, environment variables, and local files of different formats.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published