Skip to content

Craftpipe/env-doctor

env-doctor

A CLI tool that audits your project's environment configuration end-to-end.

What It Does

env-doctor scans your project and:

  • Detects missing environment variables referenced in code
  • Flags secrets accidentally committed to git history
  • Checks for mismatches between .env.example and .env files
  • Validates variable formats (URLs, ports, API key patterns)
  • Generates a color-coded health report with actionable fixes

Works across Node.js, Python, and any project using environment files.

Installation

npm install -g env-doctor

Or use directly:

npx env-doctor

Usage

Run a full audit:

env-doctor

Scan specific directory:

env-doctor --path ./src

Check git history for secrets:

env-doctor --check-git

Generate report file:

env-doctor --output report.json

Fix common issues automatically:

env-doctor --fix

Options

Flag Description
--path <dir> Scan specific directory (default: current)
--check-git Scan git history for exposed secrets
--output <file> Save report to JSON file
--fix Auto-fix common issues
--strict Fail on any warnings
--ignore <pattern> Ignore files matching pattern

Example Output

✓ 24 variables validated
⚠ 3 missing variables detected
  - DATABASE_URL (referenced in config.js:12)
  - API_SECRET (referenced in auth.py:45)
  - REDIS_PORT (referenced in cache.js:8)

✗ 2 secrets found in git history
  - AWS_KEY in commit a3f2d1e

Health Score: 65/100

FAQ

Q: Does it modify my files?
A: Only with --fix flag. Always review changes.

Q: What formats does it validate?
A: URLs, ports, API keys, email addresses, and custom regex patterns.

Q: Can I exclude certain files?
A: Yes, use --ignore flag or add patterns to .env-doctorrc.

Q: Does it work with monorepos?
A: Yes, run from root or specify paths with --path.

Q: How do I ignore false positives?
A: Add variables to .env-doctorignore file.


Built with AI by Craftpipe
Support: support@heijnesdigital.com

About

A CLI workflow tool that audits your project's environment configuration end-to-end: scans all .env files, detects missing variables referenced in code, flags secrets accidentally committed to git history, checks for mismatches between .env.example and actual .env files, validates variable formats (URLs, ports, API key patterns), and generates a co

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors