sync
Adds missing keys in both directions to keep .env and .env.example in sync.
Usage
envaudit syncenvaudit sync --dry-runenvaudit sync --env .env.local --example .env.exampleWhat it does
- Keys in
.env.examplebut missing from.envare appended to.envwith empty values - Keys in
.envbut missing from.env.exampleare appended to.env.examplewith empty values
Existing content is never modified or reordered — new keys are appended at the end.
Options
| Flag | Description |
|---|---|
--env <path> | Path to .env file (default: .env) |
--example <path> | Path to .env.example (default: .env.example) |
--dry-run | Preview changes without writing to files |
Output example
Adding to .env ✓ API_KEY ✓ REDIS_URL
Adding to .env.example ✓ DEBUG_MODE
Sync completeWith --dry-run:
Adding to .env [dry-run] ✓ API_KEY
Adding to .env.example [dry-run] ✓ DEBUG_MODE
No files were modified (dry run)