Skip to content

Repository files navigation

envlint

Checks your .env against .env.example, so a missing variable turns into a lint error instead of a 3am incident.

$ envlint
.env:4: missing: STRIPE_KEY is declared in the example but not set
.env:7: empty: DB_PASSWORD is set to an empty value
.env:9: placeholder: API_KEY still holds the placeholder 'changeme'

3 problem(s)

Exit code is 1 when something is wrong, 0 when the file is clean, 2 when a file is missing — so it drops straight into CI.

What it checks

Rule What it catches
missing key is in the example but not in your .env
empty key is set to nothing
duplicate the same key assigned twice
placeholder value is still changeme, todo, xxx...
extra key is not documented in the example (--strict)

Usage

envlint                          # .env against .env.example
envlint config/.env --example config/.env.example
envlint --strict                 # also report undocumented keys
envlint --allow-empty DEBUG,PROXY

As a pre-commit hook

repos:
  - repo: https://github.com/Flash-ware/envlint
    rev: v0.2.0
    hooks:
      - id: envlint

As a library

from envlint import lint

for problem in lint(".env", ".env.example", strict=True):
    print(problem.format(".env"))

License

MIT

About

Check your .env against .env.example before the app crashes at 3am

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages