@kth/reqvars
v2.0.1
Published
a short function for verifying that process.env contains required variables
Downloads
183
Keywords
Readme
reqvars
Check that process.env
contains all the required variables!
Install
npm i @kth/reqvars
Usage
- Write a
.env.in
saying which environmental variables are required in your program. This will be your specification file.
For example:
DB_HOST=localhost
DB_USER=root
DB_PASS=
If you commit the file (which is recommended) remember to leave the secrets (passwords, etc.) blank
As early as possible in your application, require and call
check
:require('@kth/reqvars').check()
It will throw an error if some variable is missing
If you want to use another path, pass it as argument:
require('@kth/reqvars').check('./requirements.conf')