Reads a .env file and checks for common mistakes: duplicate keys, trailing whitespace, unquoted special characters ($, `, \, !), empty values for required keys, and comments that look like they should be uncommented. Supports --fix to auto-correct trailing whitespace (with backup). Exits with code 0 for clean, 1 for warnings, 2 for errors. Ships as a single Python script with zero dependencies.
DevOpsConfigurationUtilityCLI
Features
- Duplicate key detection
- Trailing whitespace detection and auto-fix
- Unquoted special character detection ($, `, \, !)
- Required keys validation with --require flag
- Exit codes: 0 clean, 1 warnings, 2 errors
Flags
| Long | Short | Description |
|---|---|---|
| --version | -V | Show version and license |
| --file | -f | Path to .env file (default: .env) |
| --require | -r | Comma-separated list of required keys |
| --fix | -x | Auto-fix trailing whitespace (creates backup) |
| --quiet | -q | Only show issues, no summary header |
Usage
terminal
$ envcheck
$
$ envcheck --file .env.production --require DB_HOST,DB_PORT,DB_NAME --fix
Dependencies
stdlib only — no pip install required
Install
$ curl -LO https://labs.stech-sol.com/downloads/envcheck/1.0.0/envcheck_1.0.0.tar.gz
$ tar xzf envcheck_1.0.0.tar.gz
$ chmod +x envcheck/envcheck.py
$ sudo ln -s $PWD/envcheck/envcheck.py /usr/local/bin/envcheck
About
Downloads
Verify integrity
SHA256 checksums