@ephrem24/env-doctor
v1.0.0
Published
Catch missing or undocumented environment variables before your app crashes.
Maintainers
Readme
env-doctor
Catch missing or undocumented environment variables before your app crashes.
env-doctor compares your .env file against .env.example and tells you exactly what's missing, empty, or undocumented — so new teammates (and CI) stop failing on undefined is not a function five minutes into setup.
Install
npm install --save-dev env-doctorOr run it without installing:
npx env-doctorUsage
env-doctorExample output:
env-doctor: comparing .env against .env.example
✖ Missing 2 required key(s):
- API_KEY
- DEBUG
ℹ 1 key(s) in .env not documented in .env.example:
- EXTRA_UNDOCUMENTED_KEYAdd it as a pre-dev-server gate in package.json:
{
"scripts": {
"predev": "env-doctor",
"dev": "next dev"
}
}Options
| Flag | Description | Default |
|---|---|---|
| --example <file> | Path to the example env file | .env.example |
| --env <file> | Path to the actual env file | .env |
| --strict | Also fail if .env has undocumented keys | false |
| -h, --help | Show help | |
Exit codes
0— all good1— missing required keys (or extra keys in--strictmode)2— couldn't find the example file
License
MIT
