🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

acm

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

acm

another configuraiton module

2.0.1
latest
Source
npm
Version published
Maintainers
1
Created
Source

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:

  • a --github.username command line argument will be checked
  • a GITHUB_USERNAME environment variable will be checked
  • 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)

Keywords

config

FAQs

Package last updated on 27 Oct 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts