Deployed, 500'd, forgot the env var again. I built a pre-deploy gate
Описание и применение
Проверка переменных окружения перед развертыванием с помощью dotenv-diff предотвращает ошибки 500 из‑за отсутствия переменных.
Задача
Deploying an app fails with a 500 error because a required environment variable is missing in production.
Результат
Using dotenv-diff as a pre-deploy gate prevents runtime failures caused by missing environment variables, ensuring the deployed environment matches the development configuration.
Рабочий процесс
- 1. Download dotenv-diff script:
curl -O https://raw.githubusercontent.com/hahahahahahahahah6/dotenv-diff/main/dotenv_diff.py && chmod +x dotenv_diff.py - 2. Run dotenv-diff against the current .env:
./dotenv_diff.py - 3. Review output for missing, extra, empty, or placeholder entries
- 4. If any errors are reported, fix the .env file or add the missing variables
- 5. Re-run dotenv-diff to confirm no errors
- 6. Proceed with deployment
Доказательства
dotenv-diff turns that checklist line into a command. Diff .env against .env.example and catch missing keys before deploy, not after
ERRORS: [missing] STRIPE_WEBHOOK_SECRET WARNINGS: [extra] LEGACY_MAILGUN_KEY [placeholder] DATABASE_URL (value: 'postgres://changeme@localhost/db') 1 error(s), 2 warning(s)
This is not a secret manager. It doesn't encrypt, sync, or rotate anything — it's a ~200-line gate that answers one question: does the env this code runs with match the env the code was written against?
- Дата записи: 2026-10-01T20:10:41.684Z