Severity: Warning | Category: Comparison

Description

Detects keys present in a reference file (e.g., .env.example) but missing in the target file.

Examples

.env.example (reference)

DATABASE_URL=postgres://localhost
API_KEY=your-key-here
REDIS_URL=redis://localhost

.env.prod (target) - ❌ Missing keys

DATABASE_URL=postgres://prod-server

Detection

$ envcheck compare .env.example .env.prod

.env.prod: W004: Missing key: API_KEY
.env.prod: W004: Missing key: REDIS_URL

Use Cases

Pre-deployment validation

#!/bin/bash
if ! envcheck compare .env.example .env.prod --quiet; then
    echo "ERROR: Production environment is missing required keys!"
    exit 1
fi

CI/CD pipeline

- name: Validate environments
  run: |
    envcheck compare .env.example .env.staging --format=github
    envcheck compare .env.example .env.prod --format=github

Configuration

# .envcheckrc.yaml
rules:
  W004:
    severity: warning
    ignore_keys:
      - OPTIONAL_FEATURE_*  # Don't warn about missing optional keys

See Also