Skip to content

envcheck

Pythonv1.0.0MIT

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

LongShortDescription
--version-VShow version and license
--file-fPath to .env file (default: .env)
--require-rComma-separated list of required keys
--fix-xAuto-fix trailing whitespace (creates backup)
--quiet-qOnly 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
Language
Python
Versionv1.0.0
LicenseMIT
RepositoryGitHub