docs(decisions): add ADR-0018 — environment configuration strategy #80

Merged
julien merged 1 commits from docs/decisions/0018-env-config into main 2026-05-10 04:58:02 +02:00
Owner

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:

  • 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 that 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: keep 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; zod not justified yet.
  • Audit log connection: formalises the AUDIT_DATABASE_URL split that ADR-0013 §"Wired as features land" already pointed at. When 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.

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

  • No apps/portal-shell/src/environments/*.ts files yet — landed alongside the next feature that actually needs per-environment values.
  • No AUDIT_DATABASE_URL validator in BFF — same; lands when the second pool is wired.
  • No CLAUDE.md restructuring; just one extra bullet under the Architecture summary referencing ADR-0018.

Doc updates

  • docs/decisions/README.md index — new row for ADR-0018.
  • CLAUDE.md Architecture summary — one-line reference to ADR-0018 between the perf-budget and local-quality-gates entries.

Test plan

  • CI green on this PR (format:check).
  • ADR-0018 renders in the doc index with the right tags (frontend, backend, infrastructure, process) and 2026-05-10 date.
## 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**](docs/decisions/0018-environment-configuration-strategy.md): - **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 that 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**: keep `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; `zod` not justified yet. - **Audit log connection**: formalises the `AUDIT_DATABASE_URL` split that ADR-0013 §"Wired as features land" already pointed at. When 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. 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 - No `apps/portal-shell/src/environments/*.ts` files yet — landed alongside the next feature that actually needs per-environment values. - No `AUDIT_DATABASE_URL` validator in BFF — same; lands when the second pool is wired. - No CLAUDE.md restructuring; just one extra bullet under the Architecture summary referencing ADR-0018. ## Doc updates - `docs/decisions/README.md` index — new row for ADR-0018. - `CLAUDE.md` Architecture summary — one-line reference to ADR-0018 between the perf-budget and local-quality-gates entries. ## Test plan - [ ] CI green on this PR (`format:check`). - [ ] ADR-0018 renders in the doc index with the right tags (`frontend`, `backend`, `infrastructure`, `process`) and 2026-05-10 date.
julien added 1 commit 2026-05-10 04:57:32 +02:00
docs(decisions): add ADR-0018 — environment configuration strategy
CI / commits (pull_request) Successful in 1m16s
CI / check (pull_request) Successful in 1m23s
CI / scan (pull_request) Successful in 1m27s
CI / a11y (pull_request) Successful in 1m33s
CI / perf (pull_request) Successful in 3m29s
2715a518bc
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.
julien merged commit 4476cbb518 into main 2026-05-10 04:58:02 +02:00
julien deleted branch docs/decisions/0018-env-config 2026-05-10 04:58:04 +02:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: julien/apf_portal#80