Automatically generate documented .env.example files by scanning your codebase.
Project description
dotguard
Auto-generate documented .env.example files from your codebase.
Auto-generate documented .env.example files from your codebase.
Ever had a deploy fail because someone added os.getenv("NEW_VAR") but forgot .env.example?
dotguard fixes that - automatically.
dotguard scans your codebase and automatically generates a fully documented .env.example - grouped, commented, and ready to commit.
Features
- โก Zero dependencies โ pure Python (installs in ~1s)
- ๐ Language agnostic โ Python, JS, TS, shell, YAML, TOML
- ๐ง Smart grouping โ auto-groups variables by prefix
- ๐ Secret detection โ flags
_KEY,_SECRET,_PASSWORD,_TOKEN - ๐ค CI-ready โ
--checkfails if.env.exampleis outdated
Demo
Install
pip install dotguard-scan
Usage
dotguard scan # scan current directory โ .env.example
dotguard scan ./backend # scan specific folder
dotguard scan --output prod.env # custom output filename
dotguard scan --check # CI mode: exit 1 if undocumented vars found
dotguard diff # compare .env vs .env.example, show missing keys
dotguard audit # show all vars, which files use them, flag secrets
Quick Demo
๐ Scanning ./myproject...
โ 23 files scanned
โ 11 environment variables found
โ 3 secrets detected (SECRET_KEY, DB_PASSWORD, AUTH_TOKEN)
โ .env.example written
Variables by group:
DATABASE โโโโ 3 vars
SMTP โโ 2 vars
APP โโโโ 4 vars
SECRETS โโโ 3 vars โ
Generated Output
dotguard produces a clean, grouped .env.example with comments showing where each variable is used:
# โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
# SECRETS โ ๏ธ Never commit real values
# โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
# Used in: config.py:4
SECRET_KEY=your-secret-here
# Used in: auth.py:9
AUTH_TOKEN=your-secret-here
# โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
# DATABASE
# โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
# Used in: db.py:12, config.py:3
DATABASE_URL=postgresql://user:password@localhost:5432/dbname
# Used in: cache.py:8
REDIS_HOST=localhost
# โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
# APP
# โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
# Used in: settings.py:3
DEBUG=true
CI Integration
Add dotguard scan --check to your CI pipeline. It exits with code 1 if any environment variable in your code is missing from .env.example:
# GitHub Actions example
- name: Check env docs
run: dotguard scan --check
Supported Patterns
| Pattern | Language |
|---|---|
os.getenv("KEY") |
Python |
os.environ["KEY"] |
Python |
os.environ.get("KEY") |
Python |
process.env.KEY |
JavaScript |
$KEY / ${KEY} |
Shell |
getenv("KEY") |
Generic |
License
Licensed under The MIT License.
โญ Support & Contributing
If you find this project useful, consider:
- โญ Starring the repository
- ๐ค Following me for more projects
- ๐ ๏ธ Contributing to improve the tool
Contributions are always welcome! Feel free to open issues or submit pull requests.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dotguard_scan-0.1.0.tar.gz.
File metadata
- Download URL: dotguard_scan-0.1.0.tar.gz
- Upload date:
- Size: 10.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c2c01f8aaf32cefd12d0094fdcf411dd6507f3b4cd91fe8e49682ab22533d530
|
|
| MD5 |
38cadb10835bf6bf43a76faa8d65905a
|
|
| BLAKE2b-256 |
56294d43708aaa961b34f19b44b0482af29a49e4fcc0e1694f85062d16ec178b
|
File details
Details for the file dotguard_scan-0.1.0-py3-none-any.whl.
File metadata
- Download URL: dotguard_scan-0.1.0-py3-none-any.whl
- Upload date:
- Size: 10.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a9175417f33e7e9bc6c8e814398e888586952c6275116a325e8abeda392c4549
|
|
| MD5 |
5e3f36de98efaf445d7467c734b2be66
|
|
| BLAKE2b-256 |
c3fe465621d6e1172ab3ebaf9d5095fe2fd836242eb4356d5ba2a6c56d2c44a5
|