feat(portal-shell): wire environment.ts per ADR-0018 #90
Reference in New Issue
Block a user
Delete Branch "feat/portal-shell/environment-ts-wiring"
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
First implementation step of ADR-0018. Create
src/environments/environment.tsholding the two SPA per-environment values the ADR calls out —bffApiBaseUrlandotlpEndpoint— and replace the hard-coded URLs at the two SPA call sites that needed them.What changes
environment.tswith dev defaults (http://localhost:3000/apiandhttp://localhost:4318/v1/traces). Header comment links to ADR-0018, documents the constraint that per-environment siblings must share the same shape, and notes that nothing here is a secret (the SPA bundle is public).observability/tracing.tsreadsenvironment.otlpEndpointfor the exporter, and derives thepropagateTraceHeaderCorsUrlsregex fromenvironment.bffApiBaseUrl— a future change to the BFF origin propagatestraceparentto the right host automatically, no second edit needed.home-status.service.tsbuilds/healthas${environment.bffApiBaseUrl}/health.What this PR explicitly does NOT do
environment.staging.ts/environment.prod.tsyet. The ADR says "ship later" for those, and the real prod / staging URLs are unknown until the infrastructure ADR lands. Dropping plausible-but-wrong URLs into the repo would be worse than waiting.fileReplacementsconfiguration inproject.json— it depends on the per-environment files existing. Wired in the same PR that introduces them.AUDIT_DATABASE_URLvalidator, second Prisma client, boot-time UPDATE-rejection self-test). Also in the ADR's Confirmation list, but it touchesAuditModuleand deserves its own review. Separate PR.SERVICE_VERSIONwiring intracing.ts. Still hard-coded to'dev'; the build-time version source (same one that will feed the footer's dev-only version badge) is its own small chantier.Test plan
pnpm exec nx run-many -t lint test build --projects=portal-shell— green (36 / 36 specs unchanged, no new tests needed).environment.tsis one literal object inlined by the bundler).pnpm exec nx serve portal-shell→ home page loads, the health widget hits the BFF, Jaeger shows the SPAdocument_load+fetch+ BFF child span trace.bffApiBaseUrltohttp://localhost:9999/api→ the fetch fails (expected), and thetraceparentpropagation regex no longer matches:3000(verifiable in Network panel — header is absent on cross-origin requests).