mirror of
https://github.com/goldbergyoni/nodebestpractices.git
synced 2025-10-29 08:37:18 +08:00
Merge pull request #575 from halfzebra/env-var-configuration
Added a bullet point on validating env vars at start-up
This commit is contained in:
@ -14,6 +14,8 @@ When dealing with configuration data, many things can just annoy and slow down:
|
||||
|
||||
4. some advanced configuration scenarios demand to inject configuration values via command line (vargs) or sync configuration info via a centralized cache like Redis so multiple servers will use the same configuration data.
|
||||
|
||||
5. the application should fail as fast as possible and provide the immediate feedback if the required environment variables are not present at start-up, this can be achieved by using [convict](https://www.npmjs.com/package/convict) to validate the configuration.
|
||||
|
||||
Some configuration libraries can provide most of these features for free, have a look at npm libraries like [rc](https://www.npmjs.com/package/rc), [nconf](https://www.npmjs.com/package/nconf) and [config](https://www.npmjs.com/package/config) which tick many of these requirements.
|
||||
|
||||
<br/><br/>
|
||||
|
||||
Reference in New Issue
Block a user