docs(decisions): add ADR-0018 — environment configuration strategy #80
Reference in New Issue
Block a user
Delete Branch "docs/decisions/0018-env-config"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Records the per-environment config strategy for both apps. ADR-only — no code changes; the implementation is anchored in §Confirmation against the next feature work that touches per-environment values.
What lands
ADR-0018 — Environment configuration:
environment.ts+ project.jsonfileReplacements. Build-time substitution; no runtime config fetch (rejected for the LCP/TTFB cost it would add and the deploy-time HTML rewrite that the alternatives need). Concretely cleans up the hard-coded URLs we left inobservability/tracing.tsandhome-status.service.ts("hard-coded for v1 — env-config when it lands" comments).process.env+ small per-key boot-time validators (the shapeapps/portal-bff/src/config/check-database-url.tsalready follows).@nestjs/configrejected as too heavy for the current key count;zodnot justified yet.AUDIT_DATABASE_URLsplit that ADR-0013 §"Wired as features land" already pointed at. When set, theAuditModuleinstantiates a second Prisma client withaudit_writer-only credentials (defense in depth); when unset, the dev fallback (shared pool +SET LOCAL ROLE audit_writerper transaction) keeps working. A boot-timeUPDATE-rejection self-test runs against the dedicated pool when configured — refuses to start if the pool can mutate the audit table.The §Confirmation block cross-references the env-var-as-boot-gate items already pre-figured in ADR-0009 / ADR-0010 / ADR-0012 / ADR-0013 / ADR-0014, so the validator pattern is the single landing place when those features ship.
What does NOT change in this PR
apps/portal-shell/src/environments/*.tsfiles yet — landed alongside the next feature that actually needs per-environment values.AUDIT_DATABASE_URLvalidator in BFF — same; lands when the second pool is wired.Doc updates
docs/decisions/README.mdindex — new row for ADR-0018.CLAUDE.mdArchitecture summary — one-line reference to ADR-0018 between the perf-budget and local-quality-gates entries.Test plan
format:check).frontend,backend,infrastructure,process) and 2026-05-10 date.Records the per-environment config strategy for both apps: SPA — Angular `environment.ts` + project.json `fileReplacements`. Build-time substitution; no runtime config fetch (rejected for the LCP/TTFB cost it would add and the deploy-time HTML rewrite the alternatives need). Concretely cleans up the hard-coded URLs we left in observability/tracing.ts and home-status.service. ts ("hard-coded for v1 — env-config when it lands" comments). BFF — `process.env` + small per-key boot-time validators (the shape `apps/portal-bff/src/config/check-database-url.ts` already follows). `@nestjs/config` rejected as too heavy for the current key count. Audit log connection — formalises the `AUDIT_DATABASE_URL` split that ADR-0013 §"Wired as features land" already pointed at: when the env var is set, the AuditModule instantiates a second Prisma client with audit_writer-only credentials (defense in depth); when unset, the dev fallback (shared pool + `SET LOCAL ROLE audit_writer` per transaction) keeps working. A boot-time UPDATE- rejection self-test runs against the dedicated pool when configured — refuses to start if the pool can mutate the audit table. Cross-references in the §Confirmation list pull together the env-var-as-boot-gate items already pre-figured in ADR-0009 / ADR-0010 / ADR-0012 / ADR-0013 / ADR-0014, so the validator pattern is the single landing place when those features ship. Doc index and CLAUDE.md updated; no code changes in this PR.