Skip to main content

Configuration

Every setting is an environment variable. There is no config file and no flag parsing. Each binary in cmd/ is its own composition root and reads its own variables, so the same name can have a different default per binary (HTTP_ADDR is :8080 for cmd/order and :8092 for cmd/order-reports).

Conventions that apply to every table below:

  • Unset and empty are the same. Every reader uses os.Getenv (or the getenv(key, fallback) helper that treats "" as unset).
  • Durations are Go durations (500ms, 90s, 48h).
  • Invalid values never crash boot, except where the table says boot error. An unparsable duration logs ignoring invalid duration env var at WARN and uses the default.
  • ENVIRONMENT is read inside the shared telemetry adapter (internal/adapters/outbound/telemetry/telemetry.go), so every binary reads it, even though no main.go names it.
  • Test-only variables (*_TEST_*, TESTCONTAINERS_*) are not listed.

cmd/order: the OLTP REST service​

Sources live in cmd/order/ unless stated otherwise.

Process and HTTP​

VariableDefaultRequired?MeaningSource
HTTP_ADDR:8080noListen address of the REST API.main.go, http.go
LOG_LEVELinfonodebug, info, warn/warning or error (case-insensitive). Anything else means info. Logs are JSON on stdout.main.go, config.go (newLogger)
SHUTDOWN_DRAIN_DELAY5snoHow long to wait after /readyz turns 503 before the listener closes (ADR 0025). 0 disables the wait. A negative or invalid value logs a warning and uses 5s.shutdown.go
CORS_ALLOWED_ORIGINShttp://localhost:5173,http://localhost:5181noComma-separated browser origins allowed to call the API: the console shell's and this repo's MFE dev ports (ADR 0007). Allowed headers are Content-Type, Authorization and Idempotency-Key (the MFE sends the last one on POST /orders, ADR 0038).internal/adapters/inbound/http/server.go

Persistence​

VariableDefaultRequired?MeaningSource
DATABASE_URLunsetnoPostgres DSN for the request pool (pgxpool, MaxConns 10, statement_timeout 5s). Unset means the in-memory adapters are used. That also turns off the Idempotency-Key middleware, the transactional outbox, the housekeeping sweeper and the order.outbox.lag_seconds gauge.config.go, adapters.go
MIGRATIONS_DATABASE_URLvalue of DATABASE_URLnoDirect, non-PgBouncer DSN used only by the golang-migrate step at boot (ADR 0029). The request pool always uses DATABASE_URL.config.go
MIGRATIONS_PATHmigrationsnoDirectory of the *.up.sql files applied at boot. Relative to the working directory (/app in the image).config.go

Events and Kafka​

VariableDefaultRequired?MeaningSource
EVENT_PUBLISHERlognolog writes each domain event as an INFO line (domain event published). kafka publishes to warehouse.order-management.events (integration) and warehouse.order-management.analytics. With DATABASE_URL set, kafka goes through the outbox_events table and the in-process relay (ADR 0022). Without it, events go straight to the broker.main.go, adapters.go
KAFKA_BROKERSlocalhost:9092 for the publishers; unset for everything elsedependsComma-separated broker list. The publishers fall back to localhost:9092. Each consumer has its own rule: the re-promise consumer starts only when this is set; the planned-capacity consumer needs it too; PATH_CATALOGUE_SOURCE=kafka, PRODUCT_CLASSIFICATION_MODE=kafka and RELEASE_CONFIRMATION_MODE=kafka are boot errors without it.kafka.go, wiring.go, planned_capacity.go, product_classification.go, release_confirmation.go
OUTBOX_RELAY_INTERVAL1snoHow long the outbox relay sleeps after a pass that found less than a full batch (100 rows). 0 or invalid means 1s.kafka.go
OUTBOX_MAX_ATTEMPTS20noFailed sends after which the outbox relay stops claiming a row (ADR 0040). The row stays in outbox_events with attempts and last_error, is logged once at ERROR, and later rows overtake it. 0 means unlimited (one poison row then blocks every later event). A negative or non-numeric value logs ignoring invalid integer env var and uses 20. Re-arm a row with UPDATE outbox_events SET attempts = 0 WHERE id = ....kafka.go, config.go (nonNegativeIntEnv)
HOUSEKEEPING_INTERVAL1hnoPeriod of the housekeeping sweeper (ADR 0032). 0 disables the sweeper. Only used when DATABASE_URL is set. It also paces the release-confirmation timeout (ADR 0043): a line is flagged on the first pass after RELEASE_CONFIRMATION_TIMEOUT, so at the default 1h that is up to 1h15m after release. Set about 5m when RELEASE_CONFIRMATION_MODE=kafka; 0 means no line is ever flagged.housekeeping.go
IDEMPOTENCY_KEY_TTL24hnoAge after which idempotency_keys rows are deleted. 0 keeps them forever.housekeeping.go
OUTBOX_RETENTION168hnoAge after which published outbox_events rows are deleted. Unpublished rows are never swept. 0 keeps them forever.housekeeping.go
RELEASE_CONFIRMATION_MODEoffnooff or kafka (case-insensitive; anything else is a boot error). kafka opens a PENDING row in release_confirmations for every line released from then on, runs a consumer of wes-work-planning's WorkUnitCreated on warehouse.work-planning.events that sets it CONFIRMED, and arms the timeout sweep (ADR 0043). Available, off by default: off writes no rows, starts no consumer and runs no sweep.release_confirmation.go
RELEASE_CONFIRMATION_CONSUMER_GROUPunset, no default on purposeyes, when mode is kafka (boot error otherwise)Stable consumer group of the release-confirmation consumer. A locally run process must not join a live group, so the binary names none. kafka mode also needs KAFKA_BROKERS, DATABASE_URL and EVENT_PUBLISHER=kafka (without it nothing reaches wes-work-planning, so no confirmation could arrive); each missing one is a boot error that names it.release_confirmation.go
RELEASE_CONFIRMATION_TIMEOUT15mnoA PENDING line released longer ago than this becomes UNCONFIRMED in the housekeeping sweep and raises the analytics-only OrderReleaseUnconfirmed. 0 disables the sweep (confirmations still work). An unparsable or negative value logs ignoring invalid duration env var and uses 15m. An operational parameter, not a business rule.release_confirmation.go
RELEASE_CONFIRMATION_RETENTION168hnoAge after which CONFIRMED release_confirmations rows are deleted, by confirmed_at. 0 keeps them. PENDING and UNCONFIRMED rows are never deleted.housekeeping.go
OUTBOUND_SHIPPING_CONSUMER_MODEoffnooff or kafka (case-insensitive; anything else is a boot error). kafka runs a consumer of outbound-shipping's ShipmentConfirmed and PackageMissedLoad on warehouse.outbound-shipping.events: the named orders' Released lines become Shipped, and a missed load re-promises the order (ADR 0051). Available, off by default: off consumes nothing, so no order ever leaves Released.outbound_shipping.go
OUTBOUND_SHIPPING_CONSUMER_GROUPunset, no default on purposeyes, when mode is kafka (boot error otherwise)Stable consumer group of the outbound-shipping consumer. A locally run process must not join a live group, so the binary names none. kafka mode also needs KAFKA_BROKERS and DATABASE_URL (the shipment_processed_events gate lives in Postgres); each missing one is a boot error that names it. The re-promise half reuses the re-promise wiring and its repromise_processed_events gate.outbound_shipping.go
DEMAND_PROJECTION_SITE_IDunsetnoTurns on the SiteSkuDemandChanged projection (ADR 0035): every allocated, re-allocated, re-promised or cancelled line emits one event for this static site, with assignment_version static-site-v1. Unset means the event is never emitted for orders that carry no fulfillment site; an order whose caller assigned a fulfillmentSiteId projects to that site with assignment_version order-site-v1 regardless (ADR 0044).config.go

Downstream dependencies and promise policy​

VariableDefaultRequired?MeaningSource
INVENTORY_STORAGE_MODEpermissivenohttp calls inventory-storage POST /reservations and DELETE /reservations/{id} behind a circuit breaker. Any other value means permissive: allocation refuses to run (downstream-not-configured) instead of faking a reservation.outbound.go
INVENTORY_STORAGE_BASE_URLunsetyes, when mode is httpBase URL of inventory-storage, for example http://inventory-storage.warehouse-systems.svc.cluster.local:80. Not validated at boot: an empty value with http mode fails each call instead.outbound.go
PRODUCT_CLASSIFICATION_MODEpermissivenokafka keeps a local copy of product-master's ProductClassified events (ADR 0036) for path eligibility. permissive treats every SKU as unclassified. http was removed and is a boot error, and so is any other unknown value.product_classification.go
PRODUCT_CLASSIFICATION_CONSUMER_GROUPunset, no default on purposeyes, when mode is kafka (boot error otherwise)Stable consumer group of the classification consumer on warehouse.product-master.events. The fleet deployment uses order-management-product-classification.product_classification.go
PATH_CATALOGUE_SOURCEnonenokafka starts three replay caches (process-path catalogue, CPT schedule, path capacity) and blocks boot until each has replayed, up to 60 s each. Any other value skips path validation and uses only the lead-time promise.outbound.go, wiring.go
DEFAULT_SITE_IDsite-1noSite whose CPT schedule the promise reads for an order without a fulfillmentSiteId; an order that carries one is promised at its own site (ADR 0047). Also the fallback of PLANNED_CAPACITY_SITE_ID.main.go, outbound.go
PROMISE_DEFAULT_LEAD_TIME48hnoLead-time fallback promise for any path without an override. 0 or invalid means 48h.outbound.go
PROMISE_PATH_LEAD_TIMESunsetnoPer-path overrides, pathId=duration pairs separated by commas, for example pick=24h,singles=6h. A malformed pair is skipped with a WARN.outbound.go, config.go (perPathLeadTimes)
PLANNED_CAPACITY_CONSUMER_GROUPunset, no default on purposenoThe on/off switch of the warehouse-planning integration (ADR 0031). Set: consume warehouse.warehouse-planning.events into the planned-capacity read model, register GET /planned-capacity and annotate order responses with capacityConstraint. Unset: none of that exists. The fleet uses order-management-planned-capacity.planned_capacity.go
PLANNED_CAPACITY_SITE_IDvalue of DEFAULT_SITE_IDnoThe warehouse-planning location an order without a fulfillmentSiteId is matched against (the fleet sets SIM1); an order that carries one is matched on its own site (ADR 0047).planned_capacity.go

Telemetry​

VariableDefaultRequired?MeaningSource
OTEL_EXPORTER_OTLP_ENDPOINTlocalhost:4317noOTLP/gRPC endpoint for traces and metrics. A bare host:port is turned into http://host:port. Export never blocks boot.main.go, internal/adapters/outbound/telemetry/telemetry.go
OTEL_SERVICE_NAMEorder-managementnoservice.name resource attribute, also the otelchi server name.main.go
SERVICE_VERSIONdevnoservice.version resource attribute. The chart sets it to the image tag.main.go
ENVIRONMENTlocalnodeployment.environment.name resource attribute.internal/adapters/outbound/telemetry/telemetry.go

cmd/mcp: the MCP server​

VariableDefaultRequired?MeaningSource
MCP_ADDR:8090noListen address of the Streamable HTTP endpoint (mounted on /*).cmd/mcp/main.go
LOG_LEVELinfonodebug, info, warn/warning or error (case-insensitive, like every other binary). Anything else means info.cmd/mcp/main.go (logLevel)
DATABASE_URLunsetnoOLTP Postgres DSN for get_order. Unset means an empty in-memory repository, so every lookup is order not found. When set, this binary also runs the OLTP migrations at boot.cmd/mcp/main.go
MIGRATIONS_DATABASE_URLvalue of DATABASE_URLnoDirect DSN for the migration step only (ADR 0029).cmd/mcp/main.go
MIGRATIONS_PATHmigrationsnoOLTP migrations directory.cmd/mcp/main.go
ANALYTICS_DATABASE_URLunsetnoAnalytical database for get_promise_health, opened read-only (no ping at boot). Unset, or a pool that cannot be created, means an empty in-memory store, so every KPI is 0.cmd/mcp/main.go
OTEL_EXPORTER_OTLP_ENDPOINTlocalhost:4317noAs for cmd/order.cmd/mcp/main.go
OTEL_SERVICE_NAMEorder-management-mcpnoservice.name resource attribute.cmd/mcp/main.go
SERVICE_VERSIONdevnoservice.version resource attribute.cmd/mcp/main.go
ENVIRONMENTlocalnodeployment.environment.name resource attribute.internal/adapters/outbound/telemetry/telemetry.go

cmd/order-projector: the analytics writer​

VariableDefaultRequired?MeaningSource
ANALYTICS_DATABASE_URLunsetyes (boot error ANALYTICS_DATABASE_URL is required)Read-write DSN of the analytical database (MaxConns 5, statement_timeout 10s). The projector owns this schema.cmd/order-projector/main.go
ANALYTICS_MIGRATIONS_PATHmigrations/analyticsnoDirectory of the analytical migrations, applied at boot.cmd/order-projector/main.go
KAFKA_BROKERSlocalhost:9092noBrokers of the warehouse.order-management.analytics topic, consumed with group order-management-analytics.cmd/order-projector/main.go
ADMIN_ADDR:8091noListen address of the admin server, which serves only GET /healthz.cmd/order-projector/main.go
LOG_LEVELinfonodebug, info, warn/warning or error (case-insensitive).cmd/order-projector/main.go
OTEL_EXPORTER_OTLP_ENDPOINTlocalhost:4317noAs for cmd/order.cmd/order-projector/main.go
OTEL_SERVICE_NAMEorder-projectornoservice.name resource attribute.cmd/order-projector/main.go
SERVICE_VERSIONdevnoservice.version resource attribute.cmd/order-projector/main.go
ENVIRONMENTlocalnodeployment.environment.name resource attribute.internal/adapters/outbound/telemetry/telemetry.go

cmd/order-reports: the analytics reader​

VariableDefaultRequired?MeaningSource
ANALYTICS_DATABASE_URLunsetyes (boot error ANALYTICS_DATABASE_URL is required)DSN of the analytical database, opened with default_transaction_read_only=on (MaxConns 5, statement_timeout 15s). Use a read-only role. The chart feeds it from the secret key ANALYTICS_READER_DATABASE_URL.cmd/order-reports/main.go
HTTP_ADDR:8092noListen address of the reports API (/reports/funnel, /reports/funnel/freshness, /healthz).cmd/order-reports/main.go
LOG_LEVELinfonodebug, info, warn/warning or error (case-insensitive).cmd/order-reports/main.go
OTEL_EXPORTER_OTLP_ENDPOINTlocalhost:4317noAs for cmd/order.cmd/order-reports/main.go
OTEL_SERVICE_NAMEorder-reportsnoservice.name resource attribute.cmd/order-reports/main.go
SERVICE_VERSIONdevnoservice.version resource attribute.cmd/order-reports/main.go
ENVIRONMENTlocalnodeployment.environment.name resource attribute.internal/adapters/outbound/telemetry/telemetry.go

How the Helm chart sets these​

charts/order-management renders a subset of the variables from dedicated values. Everything else (PATH_CATALOGUE_SOURCE, DEFAULT_SITE_ID, PROMISE_*, CORS_ALLOWED_ORIGINS and LOG_LEVEL) goes through extraEnv (or mcp.extraEnv).

The config.*, kafka.*, productClassification.*, releaseConfirmation.*, plannedCapacity.*, demandProjection.* and inventoryStorage.* values are rendered into the chart ConfigMap (templates/configmap.yaml), and the api Deployment mounts that ConfigMap with envFrom: configMapRef (gap fix D14). Explicit env entries and extraEnv win over the ConfigMap for the same key. The projector, reports and MCP Deployments do not mount it. A ConfigMap change rolls the api pods through the checksum/config annotation. charts/order-management/tests/render_test.sh (make chart-test, CI job chart-tests) asserts the mount.

Chart valueVariable (container)Rendered when
config.httpAddrHTTP_ADDR (order)always
config.eventPublisherEVENT_PUBLISHER (order)always
config.shutdownDrainDelaySHUTDOWN_DRAIN_DELAY (order)always
config.outboxRelayIntervalOUTBOX_RELAY_INTERVAL (order, via the ConfigMap)always
config.outboxMaxAttemptsOUTBOX_MAX_ATTEMPTS (order; default "20", "0" = unlimited, ADR 0040)always
config.housekeepingInterval, config.idempotencyKeyTtl, config.outboxRetentionHOUSEKEEPING_INTERVAL, IDEMPOTENCY_KEY_TTL, OUTBOX_RETENTION (order)a database is configured
kafka.brokersKAFKA_BROKERS (order)config.eventPublisher=kafka, or plannedCapacity.consumerGroup or productClassification.consumerGroup is set
productClassification.mode, .consumerGroupPRODUCT_CLASSIFICATION_MODE, PRODUCT_CLASSIFICATION_CONSUMER_GROUP (order)the value is non-empty
plannedCapacity.consumerGroup, .siteIdPLANNED_CAPACITY_CONSUMER_GROUP, PLANNED_CAPACITY_SITE_ID (order)the group is non-empty
demandProjection.siteIdDEMAND_PROJECTION_SITE_ID (order)non-empty
inventoryStorage.mode, .baseUrlINVENTORY_STORAGE_MODE, INVENTORY_STORAGE_BASE_URL (order)mode always, URL when non-empty
database.existingSecret / database.urlDATABASE_URL, MIGRATIONS_DATABASE_URL (order, mcp)a database is configured; the migrations key is optional: true
otel.endpoint, otel.serviceNameOTEL_EXPORTER_OTLP_ENDPOINT, OTEL_SERVICE_NAME (order)otel.enabled
image.tag, environmentSERVICE_VERSION, ENVIRONMENT (order, projector, reports)always
mcp.httpAddrMCP_ADDR (mcp)mcp.enabled
analytics.projector.adminAddr, analytics.migrationsPathADMIN_ADDR, ANALYTICS_MIGRATIONS_PATH (projector)analytics.enabled
analytics.reports.httpAddrHTTP_ADDR (reports)analytics.enabled
analytics.database.*ANALYTICS_DATABASE_URL (projector from key ANALYTICS_DATABASE_URL, reports from key ANALYTICS_READER_DATABASE_URL)analytics.enabled
Gaps worth knowing
  • The chart never renders ANALYTICS_DATABASE_URL for the MCP container. Unless it is added through mcp.extraEnv, get_promise_health in a chart deployment always reports zeros.
  • The outbound-shipping consumer (ADR 0051) has no chart value: charts/order-management renders neither OUTBOUND_SHIPPING_CONSUMER_MODE nor OUTBOUND_SHIPPING_CONSUMER_GROUP, and warehouse-infra's helm-values/order-management.yaml (develop, 02bf9b7) does not set them in extraEnv. Through the chart the consumer stays off, so orders stay Released; setting both variables through extraEnv is the only way to turn it on today.
  • The release-confirmation loop (ADR 0043) is off in the chart unless releaseConfirmation.mode is kafka; with the mode empty nothing is rendered. With kafka the ConfigMap carries RELEASE_CONFIRMATION_MODE, RELEASE_CONFIRMATION_CONSUMER_GROUP (default order-management-release-confirmation, override with releaseConfirmation.consumerGroup), RELEASE_CONFIRMATION_TIMEOUT (releaseConfirmation.timeout, default 15m, 0 disables the sweep) and RELEASE_CONFIRMATION_RETENTION (releaseConfirmation.retention, default 168h, 0 keeps rows), and KAFKA_BROKERS is rendered. The mode still needs config.eventPublisher=kafka and a database, and the process fails boot naming the missing variable. The sweep rides config.housekeepingInterval (default 1h); set it to about 5m when the loop is on.
  • KAFKA_BROKERS is not rendered when only extraEnv sets PATH_CATALOGUE_SOURCE=kafka with config.eventPublisher=log. That combination fails boot with PATH_CATALOGUE_SOURCE=kafka requires KAFKA_BROKERS to be set.

See also: Runbook for what each setting changes at run time, and Troubleshooting for the boot errors named above.