env-checker 🔍
检查 .env 文件的健康状态:缺失变量、占位符、敏感信息、格式问题。
痛点
- 部署时忘记更新
.env,服务挂了 .env.example和.env不同步,新成员 onboard 出问题- 敏感信息误提交到 git
- 占位符忘记替换
安装
pip install env-checker
使用
# 分析单个文件
env-checker .env
# 比较两个文件(检查缺失变量)
env-checker .env .env.example
# 检查目录中所有 .env 文件
env-checker --dir ./myproject
# JSON 格式输出(方便脚本处理)
env-checker .env --json
示例输出
📊 分析: .env
============================================================
📝 总变量数: 12
⚠️ 空值变量 (2):
• DATABASE_URL
• REDIS_URL
📌 占位符变量 (1):
• API_KEY (your-api-key-here)
🔐 敏感变量 (3):
• SECRET_KEY: a1b2c3d4e5f6...
• AWS_SECRET_ACCESS_KEY: AKIA...
• JWT_SECRET: eyJhbGciOi...
✅ 格式检查通过
比较模式
📊 比较: .env.example vs .env
============================================================
❌ .env 中缺失的变量:
• NEW_FEATURE_FLAG
• ANALYTICS_KEY
⚠️ .env.example 中缺失的变量:
• DEBUG_MODE
🔄 值不同的变量:
• NODE_ENV
功能
| 功能 | 说明 |
|---|---|
| 缺失检测 | 比较两个文件,找出缺失的变量 |
| 占位符检测 | 找出 your-xxx、changeme、TODO 等占位符 |
| 敏感信息检测 | 找出 password、secret、token 等敏感变量 |
| 空值检测 | 找出没有赋值的变量 |
| 格式检查 | 检查变量名格式、特殊字符转义 |
CI/CD 集成
# GitHub Actions
- name: Check env files
run: |
pip install env-checker
env-checker .env.example .env.production --json > env-report.json
License
MIT - Built by IndieKit
Metadata
Release files for envfile-checker 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| envfile_checker-0.1.0.tar.gz | 5.9 kB | Without provenance | Details for envfile_checker-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| envfile_checker-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for envfile_checker-0.1.0-py3-none-any.whl |
Total release size: 17.1 kB
Release files / envfile_checker-0.1.0.tar.gz
| Download URL | envfile_checker-0.1.0.tar.gz |
|---|---|
| Size | 5.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
73cf72a4a0859634782fa502efb786898194ae4f9156c6483b6eff44db576170
|
|
BLAKE2b-256 checksum How to use checksums |
e3d74b19eac24639afcae4af501addd43909827e7137db4392fbf55f99d752e2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / envfile_checker-0.1.0-py3-none-any.whl
| Download URL | envfile_checker-0.1.0-py3-none-any.whl |
|---|---|
| Size | 11.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4cd178e1427c4f21c76380fbc55e92f184a627d5052f9537a26875619e001e18
|
|
BLAKE2b-256 checksum How to use checksums |
0c4f3eee9be283dff6547e01cfa217850819d34de298fde1ce62b9623687adf2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Security for envfile-checker 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.