node-convict icon indicating copy to clipboard operation
node-convict copied to clipboard

Support loading configs from package.json/.npmrc

Open LongLiveCHIEF opened this issue 8 years ago • 1 comments

I'd like to propose adding support for loading configs from npm compatible inputs, primarily the package.json file or .npmrc.

  • The file override could be enhanced to read either a .json or an .npmrc
  • The ENV key could be enhanced to support npm-config env vars
  • A new key could be added, which loads from the config block of the local package.json file

I think this could provide added benefit to the abilities of convict:

  • easier to use with CI testing tools, such as travis, which automatically take direction from the .npmrc
  • would enable the usage of two convict apps on the same system, without worrying about clashing env vars
  • would allow multiple config targets within a single application to do directory-recursive overrides (ex... a web app with 2 servers, a user front-end, and an admin dashboard, both can load the same config module, but receive the dynamic configuration described above)

LongLiveCHIEF avatar Mar 13 '16 19:03 LongLiveCHIEF

@LongLiveCHIEF I find the idea interesting. What do other interested parties (@rfk, @vladikoff) think?

madarche avatar Mar 15 '16 18:03 madarche