Files
flyer-crawler.projectium.com/docs/adr/0007-configuration-and-secrets-management.md
Torben Sorensen 1bd27d7112
All checks were successful
Deploy to Test Environment / deploy-to-test (push) Successful in 14m37s
testing ADR - architectural decisions
2025-12-12 00:23:12 -08:00

1.2 KiB

ADR-007: Configuration and Secrets Management

Date: 2025-12-12

Status: Proposed

Context

The application currently accesses environment variables directly via process.env. This can lead to missing variables at runtime, inconsistent naming, and a lack of type safety. It is difficult to know at a glance which environment variables are required for the application to run.

Decision

We will introduce a centralized, schema-validated configuration service. We will use a library like zod to define a schema for all required environment variables. A singleton service will parse process.env at application startup, validate it against the schema, and provide a type-safe configuration object to the rest of the app. The application will fail fast on startup if any required configuration is missing or invalid.

Consequences

Positive: Improves application reliability and developer experience by catching configuration errors at startup rather than at runtime. Provides a single source of truth for all required configuration. Negative: Adds a small amount of boilerplate for defining the configuration schema. Requires a one-time effort to refactor all process.env access points to use the new configuration service.