Skip to content
harshitgupta31415Public

About

Validate environment files against a documented template without exposing secret values.

Topics

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

envproof

Validate .env files against .env.example without printing secret values.

envproof catches the configuration mistakes that often surface only after a deploy: missing keys, accidentally empty values, duplicate declarations, and undocumented variables. It uses only the Python standard library at runtime.

Install

python -m pip install .

Use

envproof
envproof --template .env.production.example --env .env.production
envproof --strict --allow-empty OPTIONAL_ANALYTICS_ID
envproof --json

Example output:

envproof: environment needs attention
  missing: DATABASE_URL
  empty: CLERK_SECRET_KEY
  undocumented (strict): OLD_API_KEY

Only key names appear in output. Values are never interpolated, evaluated, or logged.

Exit codes

Code Meaning
0 Required keys are present and non-empty
1 Validation failed
2 A requested file does not exist

With --strict, undocumented keys also make validation fail. JSON output is suitable for CI pipelines and editor integrations.

CI integration

Keep a committed .env.ci containing non-secret test values, then validate it against the documented contract before merging:

- name: Validate environment contract
  run: envproof --template .env.example --env .env.ci --strict

A complete least-privilege GitHub Actions workflow is available in examples/github-actions.yml. Never commit a production .env file merely to validate it in CI.

Development

python -m pip install -e .
python -m unittest discover -s tests -v

License

MIT

About

Validate environment files against a documented template without exposing secret values.

Topics

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages