Env File Compare for Prod/Staging Drift
TL;DR: Two .env files can look almost identical but hide missing keys, type mismatches, and subtle value changes that only break one environment.
Why Env Files Drift
Env files are often edited by hand, copied between services, or patched during hotfixes. Over time, keys drift:
- Keys exist in staging but not in production (or vice versa)
- Values have different types, like
"true"vstruein feature flags - Old connection strings or hosts stick around in one environment
Example: Feature Flag Drift
# staging
FEATURE_X_ENABLED=true
# production
FEATURE_X_ENABLED="true" # string, not boolean
Many frameworks treat these differently. Staging evaluates the flag as a boolean, while production keeps it as a string and may always treat it as "on" or "off" depending on casting rules.
Compare Env Files Safely
Use the Config Diff Inspector to:
- Detect missing
env:keys between prod and staging - Highlight type mismatches like
"1"vs1 - Spot changed values for critical hosts, connection strings, and secrets
Compare Your Env Files Now
Paste your .env files into the Config Diff Inspector to find drift before it hits production.