-
Notifications
You must be signed in to change notification settings - Fork 6
Features
John Biundo edited this page Aug 24, 2019
·
10 revisions
- Simply install, configure, set up a
dotenv
file and go - Based on good ole
dotenv
(not a fork/extension) -
Docker-friendly: e.g., use
.env
files in dev/test, environment variables in production, or any combination - @hapi/joi-based validation of environment variables
-
Completely dynamic and customizable
determination of the name/location of your
.env
file- means: no code changes to handle unique configs per environment
- Default values (i.e., optional environment variables with default values)
- Type-safe (e.g.,
configMgr.get<number>('PORT')
returns a number (no moreparseInt()
) - Easy to layer your own config service on top of the Configuration Manager to provide features like
- typeORM or database module
getConfiguration()
methods returning arbitrarily nested config objects - name spacing (e.g.,
configMgr.get('DB.PASSWORD'))
- typeORM or database module
- Nest dynamic module enables easy configuration, including full async registration
- Nest dynamic module allows easy override for testing
-
Trace how an environment variable was resolved (i.e., came from external environment,
.env
file or as a default value) to help debug tricky problems between dev, test, production -
Choice to allow or prohibit extra environment variables (e.g., allow/reject
.env
file with variables not matching schema) so you can be permissive in development, strict in production -
Choice to handle configuration errors by
- shut down the app (
process.exit()
) - throw an exception
- exception has detailed validation errors for easy testing
- continue, disregarding configuration errors
- shut down the app (
- Uses system logger (i.e., respects overrides)
- Uses
debug
to let you see inside the module at runtime - Obsessively documented