Skip to main content

Configuration reference

facility-layout ships four binaries. Each one is configured only through environment variables read in its composition root (cmd/<binary>/main.go) plus a handful read by shared adapters. There are no config files and no flags. This page has one table per binary and covers every variable a production binary reads. Test-only variables (BDD_TAGS, *_TEST_*) are left out.

How values are parsed:

  • String variables go through each binary's getenv(key, fallback). An unset or empty value falls back to the default.
  • OUTBOX_RELAY_INTERVAL goes through durationEnv. An unset, malformed, zero or negative value falls back to the default, so the relay cannot be turned off this way.
  • OUTBOX_MAX_ATTEMPTS goes through intEnv. Unset falls back to 20; an explicit 0 is kept and means unlimited; a malformed or negative value logs invalid integer env var, using default at WARN and uses 20, so a typo cannot silently remove the cap (ADR-0036).
  • Housekeeping knobs (HOUSEKEEPING_INTERVAL, IDEMPOTENCY_KEY_TTL, OUTBOX_RETENTION) go through durationEnvRaw. Only an unset or malformed value falls back. An explicit 0/0s is kept and disables that knob (ADR-0026).
  • SITE_CAPABILITY_HEARTBEAT_INTERVAL goes through durationEnvRaw like the housekeeping knobs: unset, empty or malformed falls back to 5m; an explicit 0/0s disables the heartbeat (ADR-0041).
  • Durations use Go time.ParseDuration syntax (500ms, 30s, 1h, 168h).

Shared by every binary​

All four binaries call telemetry.Setup and telemetry.NewLogger (internal/adapters/outbound/telemetry), so each one reads these variables. Only the default OTEL_SERVICE_NAME differs between binaries.

VariableDefaultRequiredMeaningSource
OTEL_SERVICE_NAMEfacility-layout (facility), facility-projector, facility-reports, facility-layout-mcp (mcp)noservice.name resource attribute on every span, metric and log record. Also used as the otelchi server name.cmd/*/main.go
SERVICE_VERSIONdevnoservice.version resource attribute. In cmd/facility a value injected at build time with -ldflags "-X main.serviceVersion=..." wins over this variable.cmd/*/main.go
OTEL_EXPORTER_OTLP_ENDPOINTlocalhost:4317noOTLP/gRPC Collector endpoint for traces, metrics and logs. Both host:port and http(s)://host:port work, because the scheme and a trailing / are stripped. Export is insecure (no TLS) and non-blocking: if the Collector is unreachable, telemetry is dropped and the process still starts.cmd/*/main.go, internal/adapters/outbound/telemetry/telemetry.go
ENVIRONMENTlocalnodeployment.environment.name resource attribute.internal/adapters/outbound/telemetry/telemetry.go
LOG_LEVELinfonoMinimum level for the JSON slog logger (debug, info, warn or warning, error; case-insensitive; anything else means info).cmd/*/main.go

facility (REST API, outbox relay, housekeeping sweeper)​

VariableDefaultRequiredMeaningSource
HTTP_ADDR:8080noListen address of the REST API. Also serves /healthz and /readyz.cmd/facility/main.go
DATABASE_URL(none)yesOLTP Postgres DSN for the pgx pool (MaxConns 10, statement_timeout 5s, both fixed in internal/adapters/outbound/postgres/pool.go). If unset, the binary exits at boot with DATABASE_URL is required: this context runs on real Postgres (ADR 0039). There is no in-memory mode.cmd/facility/config.go
MIGRATIONS_DATABASE_URLvalue of DATABASE_URLnoDirect (non-PgBouncer, session-mode) DSN used only by the golang-migrate step at boot. The step needs a session-scoped pg_advisory_lock, which PgBouncer transaction pooling breaks (ADR-0023).cmd/facility/main.go
MIGRATIONS_PATHmigrationsnoDirectory of the OLTP SQL migrations, relative to the working directory.cmd/facility/main.go
EVENT_PUBLISHER(unset = kafka)noOnly kafka (or unset) is accepted. log and any other value is a boot error naming the variable (ADR 0039); the log-only publisher no longer exists.cmd/facility/config.go
KAFKA_BROKERS(none)yesComma-separated bootstrap brokers for the outbox relay sink (integration and analytics topics). If unset, the binary exits at boot with KAFKA_BROKERS is required: this context runs on real Kafka. No localhost default.cmd/facility/config.go
OUTBOX_RELAY_INTERVAL1snoSleep between empty passes of the outbox relay (ADR-0018). Zero, negative or malformed values fall back to 1s. The relay always runs.cmd/facility/main.go
OUTBOX_MAX_ATTEMPTS20noOutbox relay attempt cap (ADR-0036): a row that has failed this many sends is excluded from the relay's claims and logged once at ERROR (outbox_id, topic, event_type, key). It stays in outbox_events until re-armed (see Runbook); later rows, including rows with the same key, overtake it. 0 = unlimited (one poison row blocks the relay forever). A malformed or negative value logs a WARN and uses 20.cmd/facility/main.go, internal/adapters/outbound/postgres/outbox_relay.go
HOUSEKEEPING_INTERVAL1hnoHow often the housekeeping sweeper wakes up (ADR-0026). 0 disables the sweeper.cmd/facility/main.go, internal/adapters/outbound/postgres/sweeper.go
IDEMPOTENCY_KEY_TTL24hnoAge after which idempotency_keys rows are deleted. This bounds how late a client retry still gets the cached response (ADR-0019). 0 disables this half of the sweep.same
OUTBOX_RETENTION168h (7 days)noAge after which published outbox_events rows are deleted. Unpublished rows are never swept. 0 disables this half of the sweep.same
SITE_CAPABILITY_HEARTBEAT_INTERVAL5mnoHow often the current SiteCapabilityChanged of every active site with a declared transfer capability is re-published through the outbox (fresh time, capability_revision + 1) so network-inventory-planning's 10 minute freshness window holds (ADR-0041). Keep it at or below half of that window. 0 disables the heartbeat. Chart: config.siteCapabilityHeartbeatInterval (default 5m, no infra value required).cmd/facility/config.go, internal/adapters/inbound/heartbeat/heartbeat.go
CORS_ALLOWED_ORIGINShttp://localhost:5173,http://localhost:5186noComma-separated browser origins allowed by the CORS middleware. The defaults are the warehouse-console shell's dev port and this service's MFE remote dev port. Allowed methods are GET/POST/PUT/DELETE. Allowed headers are Content-Type, Authorization and Idempotency-Key.internal/adapters/inbound/http/server.go

Wiring (buildAdapters in cmd/facility/main.go): there is exactly one, the transactional outbox, written in the same Postgres transaction as the aggregate and fanned out to warehouse.facility.events and warehouse.facility.analytics by the relay. Missing DATABASE_URL or KAFKA_BROKERS stops the process before it opens a connection or binds a listener, and every missing variable is reported in one error. /readyz is the drain gate plus a Postgres ping plus a Kafka broker metadata check.

facility-projector (analytics writer)​

VariableDefaultRequiredMeaningSource
ADMIN_ADDR:8091noListen address of the admin server (/healthz, /readyz only).cmd/facility-projector/main.go
ANALYTICS_DATABASE_URL(none)yesAnalytical Postgres DSN (pool MaxConns 5). If unset, the binary exits immediately with ANALYTICS_DATABASE_URL is required. The same DSN runs the analytical migrations, so it must be a direct, session-capable connection.cmd/facility-projector/main.go
KAFKA_BROKERS(none)yesComma-separated brokers for the warehouse.facility.analytics consumer and its DLQ writer (warehouse.facility.analytics.dlq). If unset, the binary exits with KAFKA_BROKERS is required.cmd/facility-projector/config.go
ANALYTICS_CONSUMER_GROUP(none)yesConsumer-group id of the analytics consumer. No default in the binary; the chart sets facility-analytics (the group it has always used). Renaming it on a live system replays the whole topic.cmd/facility-projector/config.go
ANALYTICS_MIGRATIONS_PATHmigrations/analyticsnoDirectory of the analytical schema migrations. The projector is the only binary that runs them.cmd/facility-projector/main.go

facility-reports (analytics reader)​

VariableDefaultRequiredMeaningSource
HTTP_ADDR:8092noListen address of the reports API (/reports/catalog-growth, /reports/catalog-growth/freshness, /healthz, /readyz).cmd/facility-reports/main.go
ANALYTICS_DATABASE_URL(none)yesAnalytical Postgres DSN. If unset, the binary exits immediately with ANALYTICS_DATABASE_URL is required. The pool is opened read-only (default_transaction_read_only=on, MaxConns 5), so give it a read-only role. This binary never runs migrations.cmd/facility-reports/main.go, internal/adapters/outbound/analyticsstore/pool.go

facility-reports does not install the CORS middleware, so CORS_ALLOWED_ORIGINS has no effect on it.

mcp (MCP server, Streamable HTTP)​

VariableDefaultRequiredMeaningSource
MCP_ADDR:8090noListen address. The MCP Streamable HTTP endpoint is mounted at both / and /mcp, and /healthz answers liveness.cmd/mcp/main.go
DATABASE_URL(none)yesOLTP Postgres DSN (same database as facility, read-only use cases only). If unset, the binary exits at boot with DATABASE_URL is required. There is no in-memory store.cmd/mcp/main.go
MIGRATIONS_DATABASE_URLvalue of DATABASE_URLnoDirect DSN for the migration step. The MCP binary also runs the OLTP migrations at boot (ADR-0023).cmd/mcp/main.go
MIGRATIONS_PATHmigrationsnoDirectory of the OLTP SQL migrations.cmd/mcp/main.go
REPORTS_BASE_URL(unset)noBase URL of facility-reports, for example http://facility-reports:8092. When set, the catalog-growth report tool is registered and calls the reports REST API. When unset, that tool is not registered at all.cmd/mcp/main.go

a2a (A2A agent, JSON-RPC over HTTP)​

VariableDefaultRequiredEffectRead in
A2A_ADDR:8093noListen address. The JSON-RPC endpoint is mounted at both / and /a2a, the Agent Card at /.well-known/agent-card.json, and /healthz answers liveness.cmd/a2a/main.go
A2A_AGENT_URL(none)yesAbsolute http(s) URL of this agent's JSON-RPC endpoint, advertised on the Agent Card. If unset or not an absolute http(s) URL, the binary exits at boot with A2A_AGENT_URL is required / is not an absolute http(s) URL. The chart defaults it to the in-cluster Service DNS.cmd/a2a/main.go
DATABASE_URL(none)yesOLTP Postgres DSN (same database as facility, read-only use cases only). If unset, the binary exits at boot with DATABASE_URL is required. There is no in-memory store.cmd/a2a/main.go
MIGRATIONS_DATABASE_URLvalue of DATABASE_URLnoDirect DSN for the migration step (ADR-0023).cmd/a2a/main.go
MIGRATIONS_PATHmigrationsnoDirectory of the OLTP SQL migrations.cmd/a2a/main.go

a2a needs no KAFKA_BROKERS: it is read-only and publishes nothing (ADR-0043).

Boot-time behaviour that depends on configuration​

  • Boot retry. Each binary retries its first Postgres operations (running migrations, then pinging the pool) through internal/adapters/outbound/bootretry: 5 attempts with backoff delays of 1s, 2s, 4s and 8s, so 15s of waiting in total before it gives up and exits with the last real error. No delay follows the fifth attempt, so the real budget is 15s plus the duration of the attempts. The retry covers the Istio native-sidecar first-dial reset (ADR-0028).
  • Fail-closed everywhere (ADR 0039). Every binary refuses to start without its mandatory configuration and the error names the variable: facility needs DATABASE_URL and KAFKA_BROKERS, mcp needs DATABASE_URL, facility-projector needs ANALYTICS_DATABASE_URL, KAFKA_BROKERS and ANALYTICS_CONSUMER_GROUP, facility-reports needs ANALYTICS_DATABASE_URL. There is no in-memory fallback and no log-only publisher.
  • Kafka at boot. Brokers are not pinged at boot. /readyz checks the broker (metadata, cached for a few seconds, never a topic), so an unreachable broker takes the pod out of rotation; the outbox keeps the events and the relay publishes them when it is back (see Troubleshooting).

See also: Runbook for how the Helm chart sets these variables, and Observability for the telemetry they control.

How the Helm chart delivers facility's variables​

charts/facility-layout/templates/configmap.yaml renders config.* (plus kafka.brokers, always) into a ConfigMap named after the release: HTTP_ADDR, MIGRATIONS_PATH, EVENT_PUBLISHER, OUTBOX_RELAY_INTERVAL, OUTBOX_MAX_ATTEMPTS (config.outboxMaxAttempts, default 20), HOUSEKEEPING_INTERVAL, IDEMPOTENCY_KEY_TTL, OUTBOX_RETENTION, SITE_CAPABILITY_HEARTBEAT_INTERVAL (config.siteCapabilityHeartbeatInterval, default 5m), KAFKA_BROKERS. The api Deployment mounts it with envFrom: configMapRef (gap fix D14, 2026-10-12), so every config.* value reaches cmd/facility. Explicit env entries (the same values, plus the Secret-backed DSNs and the OTel variables) and extraEnv win over the ConfigMap for the same key. The projector, reports and MCP Deployments do not mount the ConfigMap; their variables are set explicitly in their own templates. The chart refuses to render without database.url / database.existingSecret or kafka.brokers, refuses config.eventPublisher other than kafka, kafka.enabled=false, an extraEnv that sets EVENT_PUBLISHER or a *_MODE, and a terminationGracePeriodSeconds under 20.