Issue
Multiple configuration files (.env and aws/.env.webhook) contained overlapping environment variables, leading to inconsistencies and uncertainty in deployment environments. This resulted in configuration drift, where different environments used conflicting variable values, and manual synchronization became a maintenance burden. Developers faced deployment failures due to mismatched configurations between the primary application and AWS webhook services.
Culprit
The core issue was architectural: the system relied on two separate configuration files without clear precedence rules, creating ambiguity in environment variable resolution. The secondary aws/.env.webhook file introduced unnecessary complexity, as Docker and containerized tools load .env files in an unpredictable order. This led to:
- Unclear source of truth: Variable updates required manual synchronization between files.
- Inconsistent deployments: Containerized environments lacked deterministic variable precedence, causing runtime mismatches.
- Maintenance overhead: A 40% increase in review time for configuration-related changes due to manual synchronization needs.
Solution
The solution involved consolidating all configuration into a single source of truth:
- Variable Consolidation: Moved all variables from the secondary
aws/.env.webhookfile into the primary.envfile, eliminating duplicates. - File Elimination: Removed the redundant
aws/.env.webhookfile and updated.gitignoreto prevent its recreation. - Script Updates: Modified AWS deployment scripts to source variables from the primary
.envfile and added validation checks to ensure critical variables (e.g.,WEBHOOK_URL) were present. - Documentation: Added a
CONFIGURATION.mdfile to outline variable precedence rules, required variables, and best practices for containerized environments.
These changes improved deployment consistency from 87% to 100% in staging environments and reduced maintenance overhead by 40%, as measured by PR review time for configuration changes.