config4u

0.1.1 • Public • Published

config4u

Environment, command line or JSON file with comments and single quotes

Wanted multiple tiered config like config https://github.com/lorenwest/node-config will use NODE_ENV and ALCE parsing like getconfig with the added ability to define config.json directory or filename via command line --config or environment variable NODE_CONFIG_DIR

Install 🔨

npm install config4u

Usage 💡

{
    postgres: {
        "url": '...', // database connection url
    }
}
config = new require('config4u')({ default: "values"})
dburl  = config.postgres.url
node myapp.js --config dir_or_filename // /somepath for /somepath.config.json or dev_config.json for /current_dir/dev_config.json

Assignment order

  • Passed in defaults
  • config.json file (in current application directory if not defined by --config)
  • config.json file (as defined by --config)
  • config.json file (optionally if defined by NODE_CONFIG_DIR)
  • NODE_ENV environment value as JSON string, ex: NODE_ENV = "{postgres: {url: '...'}}"

Contributions 💪

😄 Feedback, problem reports, enhancement requests are welcome.

🆙 Example code are better.

🆒 Pull requests are best.

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i config4u

Weekly Downloads

4

Version

0.1.1

License

none

Last publish

Collaborators

  • angleman