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 = 'config4u' default: "values"dburl = configpostgresurl
node myapp.js --config dir_or_filename // /somepath
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 byNODE_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.