Skip to content

snapenv diff ​

Compares a local .env file to remote variables. Useful as a CI gate or before pushing.

Usage ​

bash
snapenv diff --env prod
snapenv diff --env prod --file .env.prod
snapenv diff --env prod --keys DATABASE_URL,REDIS_URL

Flags ​

FlagDefaultDescription
--env$SNAPENV_ENVEnvironment to compare against
--project$SNAPENV_PROJECTProject UUID
--file.envLocal file to compare
--keys—Comma-separated key filter

Output ​

Color-coded diff:

~ DATABASE_URL   (value differs)
+ FEATURE_FLAG   (remote only — not in local file)
- LEGACY_KEY     (local only — not in remote)
SymbolMeaning
~ yellowKey exists in both, values differ
+ greenRemote only (missing locally)
- redLocal only (missing remotely)

Exit codes ​

CodeMeaning
0No differences
1Differences found (or error)

Exit code 1 on differences makes snapenv diff useful as a CI gate to detect config drift:

yaml
- name: Check for config drift
  run: snapenv diff --env prod
  # Fails the step if local .env doesn't match remote

Built with SnapEnv