Skip to main content

Configuration

The repository builds four binaries, and each one reads its own environment. There are no configuration files and no flags: cmd/inventory takes no arguments (the republish-product-classifications subcommand was removed at stage E, 2026-10-17).

Postgres and Kafka are the only runtime (ADR 0042). There is no in-memory mode, no log-only publisher, no permissive location lookup and no opt-in consumer. A variable marked yes in the Required? column has no default: when it is missing the process exits before telemetry, the listener or any dial, with an error that names the variable. The remaining variables take the default shown below: every reader uses the same getenv(key, fallback) helper, which treats an empty string as unset.

Test-only variables (*_TEST_*) are not listed.

cmd/inventory — the OLTP REST API​

Read in cmd/inventory/config.go (loadConfig) unless the source column says otherwise. loadConfig validates everything first and reports the first problem.

VariableDefaultRequired?MeaningSource
HTTP_ADDR:8080noListen address of the REST API (/healthz, /readyz and every route in apis/openapi.yaml except /reports/*).config.go
DATABASE_URL(none)yesPostgres DSN for the runtime pgxpool. Migrations, the idempotency middleware, the transactional outbox and the housekeeping sweeper all run on it.config.go
MIGRATIONS_DATABASE_URLvalue of DATABASE_URLnoDirect (non-PgBouncer) DSN used only by the golang-migrate startup step; the pool always uses DATABASE_URL (ADR 0023).config.go, postgres.go
MIGRATIONS_PATHmigrationsnoDirectory of the OLTP *.up.sql files, relative to the working directory.config.go
KAFKA_BROKERS(none)yesComma-separated host:port broker list. There is no localhost:9092 default. The outbox relay, the six stable-group consumers, the facility cache (LOCATION_LOOKUP_MODE=kafka) and the /readyz broker check all use it.config.go
LOCATION_LOOKUP_MODE(none)yesWhere StowStock gets zone attributes for a bin: kafka (local cache fed by warehouse.facility.events; startup blocks until the replay finishes) or http (synchronous facility-layout call behind a circuit breaker, the documented rollback for kafka). Unset, permissive and anything else are a boot error.config.go, lookup.go
FACILITY_LAYOUT_BASE_URL(none)when LOCATION_LOOKUP_MODE=httpBase URL of facility-layout; the client calls GET <base>/locations/<binId>/classification.config.go, internal/adapters/outbound/facilitylayout/client.go
TRANSFER_ALLOCATION_CONSUMER_GROUP(none)yesStable consumer group of the network-inventory-planning TransferAllocationRequested command consumer (ADR 0030). The consumer always runs. The id must be stable so a restarted pod resumes from its committed offsets; use a different id when running a second process locally so it never steals the deployed group's partitions.config.go, transfer.go
PRODUCT_MASTER_CONSUMER_GROUP(none)yesStable consumer group of the product-master consumer: ProductClassified (ADR 0034) and the pack-level events ProductPackLevelDeclared / ProductPackLevelRetired (ADR 0046), all on warehouse.product-master.events. Always runs.config.go, productmaster.go
INBOUND_RECEIPT_CONSUMER_GROUP(none)yesStable consumer group of the inbound-receiving ReceiptLineReceived consumer (ADR 0037). Always runs; the booked StockReceived leaves through the outbox like every other event.config.go, inboundreceipt.go
RETURN_LINE_CONSUMER_GROUP(none)yesStable consumer group of the returns-processing ReturnLineStaged consumer on warehouse.returns-processing.events (ADR 0044). Always runs; the booked StockReceived leaves through the outbox. Chart value config.returnLineConsumerGroup (inventory-storage-return-lines).config.go, returnline.go
SLOT_PLAN_CONSUMER_GROUPinventory-storage-slot-plannoStable consumer group of the slotting-optimization SlotPlanApproved consumer on warehouse.slotting-optimization.events (ADR 0050). Always runs, and unlike the other groups it has a default, so a deployment that predates the consumer boots unchanged. A new group replays the topic from the earliest offset, which rebuilds the forward-slot map (forward_pick_face_plans, forward_pick_faces) from the approved plans' history. No chart value: set it through extraEnv to override.config.go, slotplan.go
TASK_COMPLETED_CONSUMER_GROUP(none)yesStable consumer group of the fulfillment-execution TaskCompleted confirm-pick consumer (ADR 0035, ADR 0036). Always runs; dials the first broker under boot retry before starting.config.go, confirmpick.go
EVENT_PUBLISHER(unset)no (guard)Kept only because warehouse-infra still sets it. Unset or kafka (case-insensitive) is the single behaviour: events leave through the transactional outbox and the relay, onto the integration and analytics topics (ADR 0017). Any other value (log) is a boot error.config.go
TRANSFER_ALLOCATION_CONSUMER_MODE, TASK_COMPLETED_CONSUMER_MODE(unset)no (guard)Same guard for the two consumers that used to be opt-in: unset or kafka; off or anything else is a boot error. The consumers always run.config.go
OUTBOX_RELAY_INTERVAL1snoPoll interval of the outbox relay, which always runs. An unparsable value logs a warning and uses 1s.config.go
OUTBOX_MAX_ATTEMPTS20noOutbox relay attempt cap (ADR 0038): a row that has failed this many sends is excluded from the relay's claims and logged 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). An invalid or negative value logs a warning and uses 20.config.go, adapters.go
HOUSEKEEPING_INTERVAL1hnoHow often the housekeeping sweeper runs (ADR 0026). 0 disables the sweeper.housekeeping.go
IDEMPOTENCY_KEY_TTL24hnoAge after which an idempotency_keys row is deleted. 0 keeps rows forever.housekeeping.go
OUTBOX_RETENTION168hnoAge after which a published outbox_events row is deleted. 0 keeps rows forever.housekeeping.go
ORDER_PICK_PROGRESS_RETENTION720hnoAge (since the last pick) after which an order_pick_progress counter row is deleted (ADR 0035). 0 keeps rows forever.housekeeping.go
CORS_ALLOWED_ORIGINShttp://localhost:5173,http://localhost:5182noComma-separated origins allowed by the CORS middleware (methods GET/POST/PUT/DELETE; headers Accept, Content-Type, Authorization, Idempotency-Key). The defaults are the console shell's and this context's micro-frontend dev servers.internal/adapters/inbound/http/server.go
LOG_LEVELinfonodebug, warn/warning or error (case-insensitive); anything else is info. Logs are JSON on stdout.config.go
OTEL_SERVICE_NAMEinventory-storagenoservice.name on every span, metric and log.config.go
OTEL_EXPORTER_OTLP_ENDPOINTlocalhost:4317noOTLP/gRPC collector for traces and metrics. A value without a scheme gets http:// prepended. Export is non-blocking: an unreachable collector costs telemetry, never availability.config.go, internal/adapters/outbound/telemetry/telemetry.go
SERVICE_VERSIONdevnoservice.version resource attribute.config.go
ENVIRONMENTlocalnodeployment.environment.name resource attribute.internal/adapters/outbound/telemetry/telemetry.go

What this means at runtime:

  • Always on. The outbox relay and all four consumers (transfer allocation, product-master classification, inbound-receiving receipts, TaskCompleted confirm-pick) start with the process. A consumer that returns for any reason other than a shutdown signal makes run drain and return its error, so the process exits non-zero and the orchestrator restarts it.
  • /healthz is liveness only. /readyz is the drain gate plus a Postgres ping and a Kafka broker-metadata request; while a dependency is down it answers 503 application/problem+json of type dependency-unavailable, naming the dependency (topics are never checked). See Troubleshooting.
  • A NUL byte never reaches Postgres: 404 in the request path, 400 in the query string or the body (internal/adapters/inbound/http/nul.go).

cmd/inventory-projector — the analytics writer​

Read in cmd/inventory-projector/main.go.

VariableDefaultRequired?Meaning
ANALYTICS_DATABASE_URL(none)yesRead-write DSN of the analytical database. The process exits with ANALYTICS_DATABASE_URL is required when it is empty. Migrations and the pool both use it.
ANALYTICS_MIGRATIONS_PATHmigrations/analyticsnoDirectory of the analytical *.up.sql files, applied (under boot retry) before the pool opens.
KAFKA_BROKERS(none)yesBrokers for the warehouse.inventory.analytics consumer (group inventory-analytics). There is no localhost:9092 default; the process exits with KAFKA_BROKERS is required when it is empty.
ADMIN_ADDR:8091noListen address of the admin server: GET /healthz (liveness) and GET /readyz (the drain gate plus the analytical Postgres and Kafka; 503 dependency-unavailable while one is unreachable). The Helm chart points all three probes at /healthz.
LOG_LEVELinfonodebug, warn/warning, error; anything else is info.
OTEL_SERVICE_NAMEinventory-projectornoservice.name.
OTEL_EXPORTER_OTLP_ENDPOINTlocalhost:4317noOTLP/gRPC collector.
SERVICE_VERSIONdevnoservice.version.
ENVIRONMENTlocalnodeployment.environment.name (read by the shared telemetry adapter).

The analytics consumer is always on. If it dies without a shutdown signal the projector drains and exits non-zero.

cmd/inventory-reports — the analytics reader​

Read in cmd/inventory-reports/main.go. Unchanged by ADR 0042: it was already Postgres-only and read-only.

VariableDefaultRequired?Meaning
ANALYTICS_DATABASE_URL(none)yesDSN of the analytical database. The pool forces default_transaction_read_only=on, MaxConns=5 and statement_timeout=15s; the Helm chart feeds it the reader DSN (ANALYTICS_READER_DATABASE_URL key of the analytics secret). Exits with ANALYTICS_DATABASE_URL is required when empty.
HTTP_ADDR:8092noListen address for GET /healthz, GET /reports/flow-accuracy and GET /reports/flow-accuracy/freshness.
LOG_LEVELinfonodebug, warn/warning, error; anything else is info.
OTEL_SERVICE_NAMEinventory-reportsnoservice.name.
OTEL_EXPORTER_OTLP_ENDPOINTlocalhost:4317noOTLP/gRPC collector.
SERVICE_VERSIONdevnoservice.version.
ENVIRONMENTlocalnodeployment.environment.name.

The reports binary runs no migrations: the projector owns the analytical schema.

cmd/mcp — the MCP server​

Read in cmd/mcp/main.go. See MCP tools for what it serves. It needs Postgres only: it always publishes through the transactional outbox, and the relay that drains those rows stays in cmd/inventory, so this binary never dials Kafka and needs no KAFKA_BROKERS. It has no /readyz; its probes use GET /healthz.

VariableDefaultRequired?Meaning
MCP_ADDR:8090noListen address of the Streamable HTTP server (/mcp, /mcp/*, /* and GET /healthz).
DATABASE_URL(none)yesThe same OLTP database as cmd/inventory. The process exits with DATABASE_URL is required when it is empty.
MIGRATIONS_DATABASE_URLvalue of DATABASE_URLnoDirect DSN for the migration step only (ADR 0023). cmd/mcp applies the same OLTP migrations on start; golang-migrate makes that idempotent.
MIGRATIONS_PATHmigrationsnoDirectory of the OLTP migrations.
EVENT_PUBLISHER(unset)no (guard)Accepted only unset or kafka; any other value is a boot error. revoke_reservation always writes outbox_events rows that the cmd/inventory relay drains (this binary runs no relay).
REPORTS_BASE_URL(unset)noBase URL of cmd/inventory-reports. Setting it registers the read-only get_inventory_flow_accuracy_report tool (HTTP client timeout 10 s).
LOG_LEVELinfonodebug, warn/warning, error (case-insensitive); anything else is info.
OTEL_SERVICE_NAMEinventory-storage-mcpnoservice.name.
OTEL_EXPORTER_OTLP_ENDPOINTlocalhost:4317noOTLP/gRPC collector.
SERVICE_VERSIONdevnoservice.version.
ENVIRONMENTlocalnodeployment.environment.name.

cmd/a2a (A2A agent, ADR 0048)​

Same composition as cmd/mcp (Postgres only; every write goes through the transactional outbox and the relay stays in cmd/inventory), plus the Agent Card identity.

VariableDefaultRequired?Meaning
A2A_ADDR:8093noListen address (JSON-RPC at / and /a2a, the Agent Card at /.well-known/agent-card.json, GET /healthz).
A2A_AGENT_URL(none)yesAbsolute http(s) URL of this agent's JSON-RPC endpoint, advertised on the Agent Card. The process exits with A2A_AGENT_URL is required when it is empty and refuses a relative or schemeless URL.
DATABASE_URL(none)yesThe same OLTP database as cmd/inventory.
MIGRATIONS_DATABASE_URL / MIGRATIONS_PATH / EVENT_PUBLISHER / LOG_LEVEL / OTEL_* / SERVICE_VERSIONas cmd/mcpnoIdentical semantics; OTEL_SERVICE_NAME defaults to inventory-storage-a2a.

Compiled-in limits (not configurable)​

These are constants in code; changing them is a code change.

LimitValueSource
OLTP pgxpool MaxConns / statement_timeout10 / 5sinternal/adapters/outbound/postgres/pool.go (ADR 0022)
Projector pool MaxConns / statement_timeout5 / 10sinternal/adapters/outbound/analyticsstore/pool.go
Reports pool MaxConns / statement_timeout5 / 15s, read-onlyinternal/adapters/outbound/analyticsstore/pool.go
Boot retry (migrations, DB ping, broker dials)5 attempts, waits 1 s, 2 s, 4 s, 8 s: 15 s of backoff in total (no wait after the fifth attempt) plus the attempts' own duration; the code comment said "~31s" until gap fix D22, and ADR 0028's body still doesinternal/adapters/outbound/bootretry/retry.go (ADR 0028)
Outbox relay batch size100 rows per pass; attempt cap OUTBOX_MAX_ATTEMPTS (default 20, ADR 0038)internal/adapters/outbound/postgres/outbox_relay.go, cmd/inventory/config.go
Facility cache replay wait60 s (WaitReadyTimeout)internal/adapters/outbound/facilitycache/consumer.go
/readyz dependency verdict cache3 s (DefaultReadinessTTL), detached from the caller's cancellationinternal/adapters/inbound/http/readiness.go
facility-layout circuit breaker (LOCATION_LOOKUP_MODE=http)trips at 5 consecutive failures or > 50 % failures over ≥ 10 requests; 30 s open; 1 half-open probe; 3 attempts per call (50 ms → 500 ms back-off)internal/resilience/breaker.go, internal/adapters/outbound/facilitylayout/breaker.go
TaskCompleted handling attempts before DLQ5internal/adapters/inbound/kafka/task_completed_consumer.go
Consumer retry back-off (same message)200 ms doubling to a 5 s capinternal/adapters/inbound/kafka/transfer_consumer.go (retryBackoff)
HTTP drain / consumer and relay drain on shutdown10 s / 10 scmd/inventory/shutdown.go, cmd/inventory/adapters.go
Telemetry flush on shutdown5 scmd/*/main.go, cmd/inventory/telemetry.go
OTel metric export interval15 sinternal/adapters/outbound/telemetry/telemetry.go

Helm values to environment​

charts/inventory-storage renders these variables; anything else goes through extraEnv (API) or mcp.extraEnv (MCP). Every config.* key is rendered into the chart ConfigMap, which the API Deployment mounts with envFrom: configMapRef (explicit env entries win for the same key); the MCP, projector and reports Deployments set their own explicit env only and do not mount it. charts/inventory-storage/tests/render_test.sh asserts the mount.

The chart refuses to render a release that cannot boot (helm template, lint and install fail, naming the value; see requireRealRuntime in templates/_helpers.tpl): no database.url / database.existingSecret, kafka.enabled=false or empty kafka.brokers, a config.eventPublisher other than kafka (or empty), a config.locationLookupMode other than kafka / http (or http without config.facilityLayoutBaseUrl), a consumer mode other than kafka (or empty), an empty consumer-group id, analytics enabled without a projector DSN, or an extraEnv / mcp.extraEnv entry that overrides one of those variables with a value the binary rejects.

Values keyDefaultRequired?Variable (Deployment)
config.httpAddr, config.migrationsPath, config.logLevel:8080, migrations, infonoHTTP_ADDR, MIGRATIONS_PATH, LOG_LEVEL (API; MCP reuses the last two)
config.eventPublisherkafkano (guard: kafka or empty)EVENT_PUBLISHER (API and MCP)
config.locationLookupModekafkayes (kafka or http)LOCATION_LOOKUP_MODE (API)
config.facilityLayoutBaseUrl(empty)when config.locationLookupMode=httpFACILITY_LAYOUT_BASE_URL (API)
config.outboxRelayInterval, config.outboxMaxAttempts, config.housekeepingInterval, config.idempotencyKeyTtl, config.outboxRetention, config.orderPickProgressRetention1s, 20, 1h, 24h, 168h, 720hnoOUTBOX_RELAY_INTERVAL, OUTBOX_MAX_ATTEMPTS, HOUSEKEEPING_INTERVAL, IDEMPOTENCY_KEY_TTL, OUTBOX_RETENTION, ORDER_PICK_PROGRESS_RETENTION (API)
config.transferAllocationConsumerGroup, config.productMasterConsumerGroup, config.inboundReceiptConsumerGroup, config.returnLineConsumerGroup, config.taskCompletedConsumerGroupinventory-storage-transfer-allocation, inventory-storage-product-master, inventory-storage-inbound-receipts, inventory-storage-return-lines, inventory-storage-confirm-pickyes (non-empty)TRANSFER_ALLOCATION_CONSUMER_GROUP, PRODUCT_MASTER_CONSUMER_GROUP, INBOUND_RECEIPT_CONSUMER_GROUP, RETURN_LINE_CONSUMER_GROUP, TASK_COMPLETED_CONSUMER_GROUP (API)
(no chart value)–noSLOT_PLAN_CONSUMER_GROUP (API): the binary defaults it to inventory-storage-slot-plan; override through extraEnv
config.transferAllocationConsumerMode, config.taskCompletedConsumerModekafkano (guard: kafka or empty; off is refused)TRANSFER_ALLOCATION_CONSUMER_MODE, TASK_COMPLETED_CONSUMER_MODE (API)
database.url or database.existingSecret + existingSecretKey(empty), key DATABASE_URLyesDATABASE_URL (API and MCP)
database.migrationsExistingSecretKey(empty)noMIGRATIONS_DATABASE_URL (optional: true; API and MCP)
kafka.enabled, kafka.brokerstrue, (empty)kafka.brokers yes; kafka.enabled=false is refusedKAFKA_BROKERS (always set on the API, MCP and projector pods; the MCP binary ignores it)
otel.enabled, otel.endpoint, otel.serviceNamesee values.yamlnoOTEL_EXPORTER_OTLP_ENDPOINT, OTEL_SERVICE_NAME
environment, image.tagsee values.yamlnoENVIRONMENT, SERVICE_VERSION
analytics.projector.adminAddr, analytics.migrationsPathsee values.yamlnoADMIN_ADDR, ANALYTICS_MIGRATIONS_PATH (projector)
analytics.reports.httpAddrsee values.yamlnoHTTP_ADDR (reports)
analytics.database.*(empty)yes while analytics.enabledANALYTICS_DATABASE_URL (projector: read-write key; reports: reader key)
mcp.httpAddrsee values.yamlnoMCP_ADDR; with analytics.enabled the chart also sets REPORTS_BASE_URL to the reports Service
a2a.enabledfalsenoDeploy cmd/a2a (ADR 0048) as <release>-a2a on port 8093
a2a.httpAddr:8093noA2A_ADDR
a2a.agentUrl(empty)noA2A_AGENT_URL; empty defaults to http://<release>-a2a.<ns>.svc.cluster.local:8093/
a2a.route.*offnoKong route /api/a2a/inventory-storage rewritten to /

CORS_ALLOWED_ORIGINS has no values key: set it through extraEnv when the console is served from another origin.

The chart's default readinessProbe for the API points at /readyz, so an unreachable Postgres or broker takes the pod out of the Service. A deployment that overrides it to /healthz (the warehouse-infra values file does at the time of ADR 0042) keeps the pod in the Service during a broker outage until the override is dropped.