Skip to main content

Configuration

customer-ordering ships three binaries (cmd/api, cmd/mcp, cmd/a2a). All are configured only through environment variables: there is no config file, no flag and no secret-manager integration. REST, MCP and A2A are unauthenticated fleet-wide, so there is no token or key to configure.

All three run on real Postgres only; cmd/api additionally runs on real Kafka and a real delivery-promise endpoint. A missing mandatory variable is a boot error that names it, raised before the listener binds. The semantics below were read from cmd/*/main.go, cmd/api/config.go, cmd/*/telemetry.go and internal/adapters/outbound/telemetry/telemetry.go; test-only variables are excluded.

cmd/api​

Source: cmd/api/main.go (run), cmd/api/config.go (loadRuntime), cmd/api/telemetry.go.

VariableDefaultRequired?Meaning
HTTP_ADDR:8080noListen address of the REST server (also serves /healthz and /readyz).
DATABASE_URLnoneyesPostgres DSN. Missing = boot error DATABASE_URL is required: this context runs on real Postgres, there is no in-memory mode. The embedded migrations run at boot; the outbox, the idempotency store and every repository live here.
MIGRATIONS_DATABASE_URLvalue of DATABASE_URLnoDirect (non-pooled) DSN used only for the boot migrations, because golang-migrate's advisory lock does not survive PgBouncer transaction pooling. Empty falls back to DATABASE_URL.
KAFKA_BROKERSnoneyesComma-separated broker list (entries trimmed, blanks dropped). Missing = boot error KAFKA_BROKERS is required. Used by the three consumers, the outbox relay and the /readyz metadata check. In the fleet's kind cluster the single broker is localhost:9092 from the host.
DELIVERY_PROMISE_URLnoneyesBase URL of the delivery-promise service, called at checkout to quote, make and confirm a promise (and to cancel it when a checkout fails). Missing = boot error DELIVERY_PROMISE_URL is required.
DELIVERY_PROMISE_TIMEOUT5snoPer-call HTTP timeout toward delivery-promise, a positive Go duration. An unparsable or non-positive value is a boot error naming the variable.
DELIVERY_PROMISE_CONSUMER_GROUPnoneyesKafka consumer group id of the delivery-promise consumer (topic retailnetwork.delivery-promise.events). No default and no literal in code; the deployment chooses it. Missing = boot error DELIVERY_PROMISE_CONSUMER_GROUP is required.
ORDER_SOURCING_CONSUMER_GROUPnoneyesGroup id of the order-sourcing consumer (topic retailnetwork.order-sourcing.events).
SHIPPING_CONSUMER_GROUPnoneyesGroup id of the shipping-and-tracking consumer (topic retailnetwork.shipping-and-tracking.events).
CONSOLIDATION_KEY_SECRETnonenoSecret (at least 16 bytes) that keys the consolidation key on CustomerOrderPlaced (ADR 0012). Unset = no key is derived, the event omits the field, no order of this service is ever merged, and startup logs one WARN. A value shorter than 16 bytes is a boot error naming the variable. Rotating it only stops merges between orders keyed under different secrets. Chart: a Secret named by consolidation.existingSecret.
OUTBOX_RELAY_INTERVAL1snoPause between relay passes that did not fill a batch. A Go duration (500ms) or plain seconds (2, 0.5). Unparsable or non-positive values log a WARN and use the default.
OUTBOX_MAX_ATTEMPTS20noFailures after which the relay stops claiming an outbox row. 0 = unlimited. Negative or unparsable values log a WARN and use 20.
COMPENSATION_RETRY_INTERVAL5snoPoll interval of the compensation worker, which retries the promise cancels a failed checkout could not perform (table compensation_cancels). A Go duration (500ms) or plain seconds (2). Unparsable or non-positive values log a WARN and use 5s. Read by cmd/api only.
COMPENSATION_MAX_ATTEMPTS20noFailures after which the compensation worker stops claiming a queued cancel (it logs the row once and leaves it for an operator to re-arm). 0 = unlimited. Negative or unparsable values log a WARN and use 20. Read by cmd/api only.
SHUTDOWN_DRAIN_DELAY5snoAfter SIGINT/SIGTERM /readyz flips to 503 and the process waits this long before closing the listener. 0 disables the wait. Negative or unparsable values log a WARN and use 5s. Read when the signal arrives.
LOG_LEVELinfonodebug, info, warn (or warning), error, case-insensitive; anything else falls back to info. Logs are JSON on stdout.
OTEL_SERVICE_NAMEcustomer-orderingnoservice.name of spans and metrics.
OTEL_EXPORTER_OTLP_ENDPOINTlocalhost:4317noCollector OTLP/gRPC endpoint, bare host:port (rewritten to http://host:port) or a URL. Export never blocks: an absent Collector drops telemetry, it never fails the service.
SERVICE_VERSIONdevnoservice.version resource attribute.
ENVIRONMENTlocalnodeployment.environment.name resource attribute (read by the telemetry adapter).

With the six mandatory variables set (DATABASE_URL, KAFKA_BROKERS, DELIVERY_PROMISE_URL and the three group ids) all consumers and the outbox relay start; there is no mode switch and no in-memory fallback.

cmd/mcp​

Source: cmd/mcp/main.go, cmd/mcp/telemetry.go. Read-only MCP server over Streamable HTTP; it starts no relay or consumer and never dials Kafka or delivery-promise.

VariableDefaultRequired?Meaning
MCP_ADDR:8090noListen address.
DATABASE_URLnoneyesPostgres DSN of the service database cmd/api owns. Missing = boot error DATABASE_URL is required: this context runs on real Postgres.
MIGRATIONS_DATABASE_URLvalue of DATABASE_URLnoDirect DSN for the idempotent boot migrations (this binary also runs them, so it can boot on a fresh database).
LOG_LEVELinfonoAs cmd/api.
OTEL_SERVICE_NAMEcustomer-ordering-mcpnoservice.name of spans and metrics.
OTEL_EXPORTER_OTLP_ENDPOINTlocalhost:4317noCollector OTLP/gRPC endpoint; export never blocks.
SERVICE_VERSIONdevnoservice.version, also printed in the boot line.
ENVIRONMENTproduction in the boot log line, local in the telemetry resourcenodeployment.environment.name. The two defaults differ in code (cmd/mcp/main.go vs telemetry.DefaultEnvironment).

cmd/a2a​

Source: cmd/a2a/main.go, cmd/a2a/telemetry.go. Read-only A2A agent (JSON-RPC over HTTP, Agent Card at the well-known path); same restrictions as cmd/mcp.

VariableDefaultRequired?Meaning
A2A_ADDR:8093noListen address.
A2A_AGENT_URLnoneyesAbsolute http(s) URL of this agent's JSON-RPC endpoint, advertised on the Agent Card. Missing or not an absolute http(s) URL = boot error naming the variable, raised before telemetry or any connection.
DATABASE_URLnoneyesPostgres DSN of the service database. Missing = boot error. Missing variables are reported together.
MIGRATIONS_DATABASE_URLvalue of DATABASE_URLnoDirect DSN for the boot migrations.
LOG_LEVELinfonoAs cmd/api.
OTEL_SERVICE_NAMEcustomer-ordering-a2anoservice.name of spans and metrics.
OTEL_EXPORTER_OTLP_ENDPOINTlocalhost:4317noCollector OTLP/gRPC endpoint; export never blocks.
SERVICE_VERSIONdevnoservice.version; also the version on the Agent Card.
ENVIRONMENTproduction in the boot log line, local in the telemetry resourcenodeployment.environment.name.

cmd/co-projector (analytics projector, ADR 0018)​

Source: cmd/co-projector/main.go, cmd/co-projector/telemetry.go. Off by default in the chart (analytics.enabled). Writes ONLY the separate analytical database and never opens the OLTP database. Reads this context's own retailnetwork.customer-ordering.events (CustomerOrderPlaced, CustomerOrderCancelled, ShopperNoticeDecided), dead-letters poison to retailnetwork.customer-ordering.analytics.dlq and retries transient failures forever. Serves /healthz and /readyz on the admin port.

VariableDefaultRequired?MeaningChart value
ANALYTICS_DATABASE_URLnoneyesDirect DSN of the analytical database (read-write; runs the embedded analytical migrations).analytics.database.projectorUrl or analytics.database.existingSecret
KAFKA_BROKERSnoneyesComma-separated brokers.kafka.brokers
ANALYTICS_CONSUMER_GROUPcustomer-ordering-analyticsnoThe projector's fixed consumer group.analytics.projector.consumerGroup
ADMIN_ADDR:8091no/healthz and /readyz listen address.analytics.projector.adminAddr
LOG_LEVELinfonodebug, info, warn/warning, error.analytics.logLevel
OTEL_SERVICE_NAMEcustomer-ordering-projectornoservice.name.otel.serviceName + -projector
OTEL_EXPORTER_OTLP_ENDPOINTlocalhost:4317noCollector OTLP/gRPC endpoint.otel.endpoint
SERVICE_VERSIONdevnoservice.version.image tag
ENVIRONMENTlocalnodeployment.environment.name.environment

cmd/co-reports (read-only analytics reports, ADR 0018)​

Source: cmd/co-reports/main.go, cmd/co-reports/telemetry.go. GET /reports/ordering-performance, /reports/freshness, /healthz, /readyz over a read-only pool (15 s statement timeout). No Kafka, no OLTP database, no sibling call, no auth.

VariableDefaultRequired?MeaningChart value
ANALYTICS_READER_DATABASE_URLvalue of ANALYTICS_DATABASE_URLyes (one of the two)DSN of a read-only role on the analytical database.analytics.database.reportsUrl (falls back to projectorUrl)
ANALYTICS_DATABASE_URLnonenoSingle-role local fallback; the chart never renders it for the reports pod.not rendered
HTTP_ADDR:8092noListen address.analytics.reports.httpAddr
LOG_LEVELinfonoAs above.analytics.logLevel
OTEL_SERVICE_NAMEcustomer-ordering-reportsnoservice.name.otel.serviceName + -reports
OTEL_EXPORTER_OTLP_ENDPOINTlocalhost:4317noCollector OTLP/gRPC endpoint.otel.endpoint
SERVICE_VERSIONdevnoservice.version.image tag
ENVIRONMENTlocalnodeployment.environment.name.environment

Compiled-in settings (not configurable)​

SettingValueSource
HTTP ReadHeaderTimeout5 s (all three binaries)cmd/*/main.go
HTTP graceful shutdown / per-worker drain timeout10 s / 10 scmd/api/main.go (shutdownTimeout, workerDrainTimeout)
Postgres pool10 connections per process, statement_timeout set per connectioninternal/adapters/outbound/postgres/pool.go
Boot retry (migrations, first ping)exponential backoff, then exit non-zerointernal/bootretry
Outbox relay batch100 rows per passinternal/adapters/outbound/outbox/relay.go (DefaultBatchSize)
Attempts when another writer got in between load and save: command / consumed event2 / 5internal/application/usecases/deps.go
Consumer retry backoff200 ms doubling to a 5 s capinternal/adapters/inbound/kafka/kafka.go
/readyz verdict cache / check timeout3 s / 2 sinternal/adapters/inbound/http/readiness.go
delivery-promise response cap1 MiBinternal/adapters/outbound/deliverypromise/gateway.go
Order history pagedefault 20, maximum 100internal/application/usecases/orders_history.go
Topic producedretailnetwork.customer-ordering.eventsinternal/adapters/outbound/kafka/encoder.go
Topics consumedretailnetwork.delivery-promise.events, retailnetwork.order-sourcing.events, retailnetwork.shipping-and-tracking.eventsinternal/adapters/inbound/kafka/handlers.go

What is deliberately absent​

  • No auth variables. REST, MCP and A2A are unauthenticated fleet-wide.
  • No *_MODE variables. The consumers always run; the chart refuses a *_MODE or *_CONSUMER_GROUP variable in extraEnv.
  • No Kafka variable on cmd/mcp, cmd/a2a and cmd/co-reports.
  • Chart values. charts/customer-ordering maps these variables onto the pod; see the table in the Runbook.