Skip to main content

Configuration

Shopping Cart ships three binaries and each reads its own environment. All run on real Postgres only; cmd/api additionally needs real Kafka and the delivery-promise service. There is no in-memory mode and no permissive mode: a missing mandatory variable is a boot error that names the variable, raised before telemetry, any connection or the listener opens.

Durations are Go durations (30s, 5m, 1h) unless the row says otherwise. Source: cmd/api/main.go, cmd/api/config.go, cmd/api/telemetry.go, cmd/a2a/main.go, cmd/mcp/main.go, cmd/mcp/telemetry.go, internal/adapters/outbound/telemetry/telemetry.go.

cmd/api (REST, consumers, relay, sweepers)​

VariableDefaultRequired?Meaning
HTTP_ADDR:8080noListen address of the REST server.
DATABASE_URLnoneyesPostgres DSN of the service role. Boot error DATABASE_URL is required when empty.
MIGRATIONS_DATABASE_URLvalue of DATABASE_URLnoDirect (non-pooled, session-mode) DSN used only for the embedded boot migrations. Set it when DATABASE_URL goes through a transaction-mode pooler.
KAFKA_BROKERSnoneyesComma-separated broker list (blanks trimmed). Used by the outbox relay, the three consumers and the /readyz broker check.
DELIVERY_PROMISE_URLnoneyesBase URL of the delivery-promise service the cart calls to quote delivery offers.
DELIVERY_PROMISE_TIMEOUT5snoPer-call timeout of the delivery-promise client. Must be a positive Go duration, otherwise boot fails naming the variable.
OFFER_AVAILABILITY_CONSUMER_GROUPnoneyesKafka consumer group id of the offer-availability consumer. Must be stable and service-prefixed, never the pod name.
PRICING_CONSUMER_GROUPnoneyesConsumer group id of the pricing consumer.
CHECKOUT_CONSUMER_GROUPnoneyesConsumer group id of the checkout consumer.
CART_CURRENCYUSDnoCurrency of the labelled estimate when no priced item states one. Exactly three upper-case letters, otherwise boot fails.
ABANDON_SWEEP_INTERVAL1hnoTick of the AbandonInactive policy. Invalid or non-positive values log a warning and fall back to the default.
PURGE_SWEEP_INTERVAL6hnoTick of the PurgeAbandonedCarts policy. Same fallback rule.
IDEMPOTENCY_PURGE_INTERVAL1hnoTick of the idempotency-key retention sweep (PurgeExpiredIdempotencyKeys, ADR 0011 addendum): expired idempotency_keys rows (older than the 24-hour TTL) are deleted in bounded batches. Same fallback rule.
OUTBOX_RELAY_INTERVAL1snoOutbox relay poll interval, a Go duration or plain seconds (2, 0.5). Invalid values warn and use the default.
OUTBOX_MAX_ATTEMPTS20noFailures before the relay stops claiming an outbox row. 0 means unlimited; negative or unparsable values warn and use 20.
SHUTDOWN_DRAIN_DELAY5snoWait between flipping /readyz to 503 and closing the listener. 0 disables the wait; negative or unparsable values warn and use the default.
LOG_LEVELinfonodebug, info, warn (or warning), error, case-insensitive. Anything else means info.
OTEL_SERVICE_NAMEshopping-cartnoservice.name of spans and metrics.
OTEL_EXPORTER_OTLP_ENDPOINTlocalhost:4317noOTLP/gRPC endpoint of the Collector, host:port or URL. Export never blocks startup.
SERVICE_VERSIONdevnoservice.version resource attribute.
ENVIRONMENTlocalnodeployment.environment.name resource attribute.

All three consumer groups are validated even though each consumer is always on: a missing one aborts boot with <NAME> is required: the consumer always runs on real Kafka.

cmd/a2a (read-only A2A agent)​

cmd/a2a is a second deployable (ADR 0006). It reads the same Postgres and needs no Kafka, no outbox, no consumers, no schedulers and no delivery-promise client, so none of those variables apply to it. All configuration problems are reported together, each naming its variable.

VariableDefaultRequired?Meaning
A2A_ADDR:8093noListen address of the JSON-RPC server.
A2A_AGENT_URLnoneyesAbsolute http(s) URL of this agent's JSON-RPC endpoint, advertised on the Agent Card. A relative or schemeless URL is a boot error.
DATABASE_URLnoneyesPostgres DSN, the same database as cmd/api.
MIGRATIONS_DATABASE_URLvalue of DATABASE_URLnoDirect DSN for the boot migrations (they are idempotent, so either binary may start first).
CART_CURRENCYUSDnoFallback estimate currency. Validated like cmd/api; set it to the same value so both surfaces agree.
LOG_LEVELinfonoSame values as cmd/api.
OTEL_SERVICE_NAMEshopping-cart-a2anoservice.name of spans.
OTEL_EXPORTER_OTLP_ENDPOINTlocalhost:4317noOTLP/gRPC endpoint of the Collector.
SERVICE_VERSIONdevnoservice.version resource attribute.
ENVIRONMENTlocalnodeployment.environment.name resource attribute.

cmd/mcp (read-only MCP server)​

cmd/mcp is a third deployable (ADR 0009). It reads the same Postgres and needs no Kafka, no outbox, no consumers, no schedulers and no delivery-promise client, so none of those variables apply to it. A missing DATABASE_URL and a bad CART_CURRENCY are reported together, each naming its variable.

VariableDefaultRequired?Meaning
MCP_ADDR:8090noListen address of the Streamable HTTP server (/mcp, /, GET /healthz).
DATABASE_URLnoneyesPostgres DSN, the same database as cmd/api. Boot error DATABASE_URL is required when empty.
MIGRATIONS_DATABASE_URLvalue of DATABASE_URLnoDirect DSN for the boot migrations (they are idempotent, so any binary may start first).
CART_CURRENCYUSDnoFallback estimate currency. Validated like cmd/api; set it to the same value so every surface agrees.
LOG_LEVELinfonoSame values as cmd/api.
OTEL_SERVICE_NAMEshopping-cart-mcpnoservice.name of spans and metrics.
OTEL_EXPORTER_OTLP_ENDPOINTlocalhost:4317noOTLP/gRPC endpoint of the Collector.
SERVICE_VERSIONdevnoservice.version resource attribute, also logged at boot.
ENVIRONMENTlocalnodeployment.environment.name resource attribute (read by telemetry.Setup; the chart does not render it for any component).

Helm values to environment​

The chart charts/shopping-cart maps values to these variables; the mandatory ones make helm template fail when empty. See the runbook for the value names.