Skip to main content

Configuration

Two binaries ship from this repository: cmd/api (REST, the six Kafka consumers and the outbox relay in one process) and cmd/mcp (read-only MCP server). Each reads its own environment; there is no config file and no in-memory or log-sink mode. A missing required variable is a boot error that names the variable, and cmd/api reports every missing variable in one message.

Source: cmd/api/config.go (loadConfig, groupVars), cmd/api/main.go, cmd/mcp/main.go, internal/adapters/outbound/postgres/migrate.go (MigrationsURL).

Integer variables of cmd/api are read with one rule: a value that is not a number, or is below the variable's minimum, is silently replaced by the default (no warning is logged). The minimum is 1 for OUTBOX_INTERVAL_MS and OUTBOX_BATCH (so 0 and negative values mean the default there) and 0 for OUTBOX_MAX_ATTEMPTS, where an explicit 0 means unlimited (fleet convention) and only negative or non-numeric values fall back to the default.

cmd/api (REST API, six Kafka consumers, outbox relay)​

VariableDefaultRequiredMeaning
DATABASE_URLnoneyesPostgres DSN of the OLTP database. The runtime pool is capped at 10 connections with statement_timeout = 5s (postgres.MaxConns, postgres.StatementTimeout).
MIGRATIONS_DATABASE_URLvalue of DATABASE_URLnoDirect (non-pooled) DSN used only for the embedded migrations that run at boot. Set it when DATABASE_URL goes through a pooler: golang-migrate needs a session connection for its advisory lock.
KAFKA_BROKERSnoneyesComma-separated bootstrap brokers for the consumers, the relay and the /readyz broker check (a TCP dial of the first broker).
FULFILLMENT_CONSUMER_GROUPnoneyesConsumer group of the fulfillment-execution consumer (warehouse.fulfillment.events).
DOCK_CONSUMER_GROUPnoneyesConsumer group of the dock-scheduling consumer (warehouse.dock-scheduling.events).
YARD_CONSUMER_GROUPnoneyesConsumer group of the yard-management consumer (warehouse.yard-management.events).
CPT_CONSUMER_GROUPnoneyesConsumer group of the process-path-management cutoff consumer (warehouse.process-path-management.events).
LAYOUT_CONSUMER_GROUPnoneyesConsumer group of the facility-layout consumer (warehouse.facility.events).
ANALYTICS_CONSUMER_GROUPnoneyesConsumer group of the service's own projector consumer (warehouse.outbound-shipping.analytics).
ADDR:8080noListen address of the REST API.
LOG_LEVELinfonodebug, info, warn (or warning), error; any other value is info. Case-sensitive (lower case).
OUTBOX_INTERVAL_MS250noMilliseconds the relay sleeps after a pass that did not fill a batch.
OUTBOX_BATCH100noOutbox rows claimed per relay pass.
OUTBOX_MAX_ATTEMPTS20noFailed sends after which a row is excluded from future claims (see the runbook). 0 = unlimited (the row is retried forever); negative or non-numeric = 20.

The consumer groups are deliberately plain environment variables with no default: they must be stable across restarts and prefixed with the service name (for example outbound-shipping-yard); a group id derived from the pod name would replay each topic on every restart. internal/architecture's TestKafkaConsumerGroupNeverHardcodedInline fails the build if a group id is written as a literal in a consumer.

The code defaults of the relay package itself (DefaultInterval 1 s, DefaultMaxAttempts 20) are not what cmd/api runs with for the interval and batch: cmd/api always passes its own values (250 ms, batch 100) and takes the attempt cap from OUTBOX_MAX_ATTEMPTS, whose default is the relay package's DefaultMaxAttempts (20).

cmd/mcp (MCP server, Streamable HTTP)​

cmd/mcp reads Postgres only. It starts no relay, no consumer and never dials Kafka, so it needs no broker variable.

VariableDefaultRequiredMeaning
DATABASE_URLnoneyesPostgres DSN. Without it the binary exits at boot with DATABASE_URL is required.
MIGRATIONS_DATABASE_URLvalue of DATABASE_URLnoDirect DSN for the boot migrations. cmd/mcp runs the same idempotent embedded migrations as cmd/api (golang-migrate's advisory lock makes concurrent starts safe).
MCP_ADDR:8090noListen address of the MCP server.
LOG_LEVELinfonoSame values as cmd/api.

What is not configurable​

  • No auth variables. REST, MCP and the probes are unauthenticated; access control is the cluster network boundary.
  • No OpenTelemetry variables. Neither binary installs an OpenTelemetry SDK or exporter today, so OTEL_* variables have no effect (see Observability).
  • No mode toggles. There is no *_MODE, no in-memory fallback (TestRuntimeBinaryHasNoInMemoryAdapters) and no envelope toggle: every Kafka message is a CloudEvents 1.0 structured-mode event.
  • Kafka topics are constants, not environment: warehouse.outbound-shipping.events and warehouse.outbound-shipping.analytics for the topics this service writes, plus the five consumed topics above. Dead-letter topics are the consumed topic plus .dlq.