Guide
env-doctor quickstart — audit .env in 5 minutes
Goal
Audit a project .env against .env.example and fix drift, duplicates, placeholders, and risky secrets.
Prerequisites
- Python 3.9+ installed
- A project with
.envand.env.examplefiles
Steps
- Get env-doctor (clone it once, anywhere):
git clone https://github.com/techdevfun/env-doctor.git cd env-doctor # Optional: make the command available from any folder pip install -e . - From your PROJECT folder (not the env-doctor folder), run the check against your project's files:
cd /path/to/your-project python -m env_doctor check --env .env --example .env.examplePoint
--env/--exampleat your project files (absolute or project-relative paths). Do not run it against the env-doctor folder itself. - Fix drift by hand: add missing keys to
.env.exampleas empty placeholders, and remove keys that should no longer exist. env-doctor does not auto-fix yet — its auto-fix flag is on the roadmap, not implemented. - Also flag vars not referenced in code (still from your project folder):
python -m env_doctor check --env .env --example .env.example --scan .
Expected output (drift example)
[ERROR] duplicate-key: Duplicate key 'DATABASE_URL' (line 3)
[ERROR] missing-in-env: 'NEW_API_URL' is in .env.example but missing in .env
Summary: 2 error(s), 2 warning(s), 3 key(s).Verify
Re-run the check. You should see Summary: 0 error(s). Exit code 0 means no errors.
Troubleshoot
- Command not found: check
python --versionis 3.9+ and env-doctor is installed / on PYTHONPATH and you are in your project folder. - Warnings only: warnings do not fail the run. Review them; do not blindly delete vars.
- Leaked secret: env-doctor does not fix leaked secrets — rotate the secret immediately.
Last updated: 2026-10-16. Edit on GitHub · Report an issue
← Previous guide · Next guide →
Still stuck? Get deployment help →