checkenvwtf
v1.0.1
Published
Validate .env files against schema. No more undefined in production.
Maintainers
Readme
envguard
Validate .env files against schema. No more undefined in production.
Documentation · Report Bug · All Tools
Install
npm install -g envguardUsage
# validate .env against .env.schema
envguard
# ✓ valid. 12 variables checked.
# generate schema from existing .env
envguard init
# ✓ schema generated: .env.schema
# compare two env files
envguard diff .env .env.prod
# only in .env.prod:
# + PROD_API_KEY
# different values:
# ~ DEBUG
# list all variables
envguard listSchema Format
Create .env.schema:
# Required variables (no default)
DATABASE_URL
API_KEY
# With type validation
PORT=port
DEBUG=boolean
API_URL=url
ADMIN_EMAIL=email
MAX_CONNECTIONS=number
# Optional variables (with ?)
OPTIONAL_VAR?
ANALYTICS_ID?
# With default value
NODE_ENV=string:development
TIMEOUT=number:30Types
| Type | Description | Example |
|------|-------------|---------|
| string | Any string (default) | hello |
| number | Numeric value | 42, 3.14 |
| boolean | true/false/1/0/yes/no | true |
| url | Valid URL | https://example.com |
| email | Valid email | [email protected] |
| port | Port number (1-65535) | 3000 |
Commands
| Command | Alias | Description |
|---------|-------|-------------|
| check | c | Validate .env against schema (default) |
| diff | d | Compare two .env files |
| init | i | Generate schema from .env |
| list | l | List all variables |
Options
| Flag | Description | Default |
|------|-------------|---------|
| -e, --env | Path to .env file | .env |
| -s, --schema | Path to schema file | .env.schema |
| -o, --output | Output file for init | .env.schema |
| --strict | Fail on extra variables | false |
| --quiet | Only output errors | false |
CI/CD Integration
# GitHub Actions
- name: Validate environment
run: envguard check --strict
# Pre-commit hook
envguard check || exit 1More tools from rtfm.codes
- cronwtf — cron expression explainer
- depcheck — dependency security scanner
- logparse — log parser and searcher
License
MIT © rtfm.codes
rtfm.codes — it works. the docs explain why.
