Skip to main content

Configuration

offer-availability ships three binaries, cmd/api, cmd/mcp and cmd/a2a, and all three are configured only through environment variables. There is no config file, no flag and no secret-manager integration in the repository. REST, MCP and A2A are unauthenticated fleet-wide, so there is no token or key to configure.

The service runs on real Postgres and real Kafka only. cmd/api has three mandatory variables (DATABASE_URL, KAFKA_BROKERS, NODE_TOPOLOGY_CONSUMER_GROUP, SELLER_INBOUND_CONSUMER_GROUP); cmd/mcp needs DATABASE_URL; cmd/a2a needs DATABASE_URL and A2A_AGENT_URL. A missing mandatory variable is a boot error that names it, raised before the listener binds. Only cmd/api dials Kafka: cmd/mcp and cmd/a2a have no KAFKA_BROKERS, no consumer group and no outbox.

Every variable below is read in the binary's main package or in the internal/adapters/outbound/postgres and internal/adapters/outbound/telemetry helpers; no other package reads the environment. The test-only variables of the integration harness (testcontainers) are excluded. An invalid optional value logs a warning and falls back to its default; the exceptions are noted per row.

cmd/api​

VariableDefaultRequired?Meaning
DATABASE_URLnoneyesPostgres DSN of the service pool (10 connections, statement_timeout = 10s). Missing = boot error missing required environment variable: DATABASE_URL. The embedded migrations run at boot; the outbox, the Idempotency-Key store and every repository live here. Source: cmd/api/config.go (loadConfig), internal/adapters/outbound/postgres/config.go.
MIGRATIONS_DATABASE_URLvalue of DATABASE_URLnoDirect (non-pooled) DSN used only for the boot migrations, because golang-migrate holds a session advisory lock that breaks behind a transaction-pooling proxy. Empty falls back to DATABASE_URL.
KAFKA_BROKERSnoneyesComma-separated host:port list (entries trimmed, blanks dropped). Missing or blank = boot error missing required environment variable: KAFKA_BROKERS (comma-separated host:port list). Used by the outbox relay, the node-topology consumer and the /readyz metadata check. From the host, the fleet's single broker is localhost:9092.
NODE_TOPOLOGY_CONSUMER_GROUPnoneyesConsumer group id of the node-topology consumer. Never defaulted, so a local process cannot join a live cluster's group by accident. Missing or blank = boot error missing required environment variable: NODE_TOPOLOGY_CONSUMER_GROUP.
SELLER_INBOUND_CONSUMER_GROUPnoneyesConsumer group id of the seller-inbound consumer (topic retailnetwork.seller-inbound.events, ADR 0013). Same rules. Missing or blank = boot error missing required environment variable: SELLER_INBOUND_CONSUMER_GROUP.
CUSTOMER_RETURNS_CONSUMER_GROUPnoneyesConsumer group id of the customer-returns consumer (topic retailnetwork.customer-returns.events, ADR 0015). Same rules. Missing or blank = boot error missing required environment variable: CUSTOMER_RETURNS_CONSUMER_GROUP.
HTTP_ADDR:8080noListen address of the REST server (also serves /healthz and /readyz).
OUTBOX_RELAY_INTERVAL1snoPause between relay passes that did not fill a batch (batch = 100 rows). A Go duration (500ms, 2s) or plain seconds (2, 0.5). Unparsable or non-positive = warning + default.
OUTBOX_MAX_ATTEMPTS20noFailures after which the relay stops claiming an outbox row. 0 = unlimited. Negative or unparsable = warning + 20, so a typo never removes the cap (ADR 0005).
FEED_APPLY_CHUNK_SIZE500noBatch cap while an inventory feed settles: at most this many changed listings per bulk save and this many events per outbox append. A full feed can touch every listing of a node, so bounded batches keep each lock-held write small; the feed itself still settles in one transaction. Negative or unparsable = warning + 500.
RETENTION_INTERVAL1hnoHow often the retention janitor purges idempotency keys older than 24 h and feeds and processed events older than 30 days. Go duration; unparsable or non-positive = warning + 1h.
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 = warning + 5s.
LOG_LEVELinfonodebug, info, warn (or warning), error, case-insensitive; anything else is info. Logs are JSON on stdout.
OTEL_SERVICE_NAMEoffer-availabilitynoservice.name of spans and metrics.
OTEL_EXPORTER_OTLP_ENDPOINTlocalhost:4317noCollector OTLP/gRPC endpoint, bare host:port (becomes http://host:port) or a URL. Export never blocks: an unreachable Collector costs telemetry, never availability.
SERVICE_VERSIONdevnoservice.version resource attribute.
ENVIRONMENTlocalnodeployment.environment.name resource attribute.

cmd/mcp​

Read-only Streamable-HTTP MCP server over the service database (ADR 0007). Starts no relay, consumer or janitor and never dials Kafka. Source: cmd/mcp/main.go, cmd/mcp/telemetry.go.

VariableDefaultRequired?Meaning
MCP_ADDR:8090noListen address of the MCP server.
DATABASE_URLnoneyesPostgres DSN. Missing = boot error DATABASE_URL is required: this context runs on real Postgres. The binary also runs the idempotent embedded migrations at start; golang-migrate's advisory lock makes concurrent starts with cmd/api safe.
MIGRATIONS_DATABASE_URLvalue of DATABASE_URLnoDirect DSN for the boot migrations only.
LOG_LEVELinfonoAs in cmd/api.
OTEL_SERVICE_NAMEoffer-availability-mcpnoservice.name of spans and metrics.
OTEL_EXPORTER_OTLP_ENDPOINTlocalhost:4317noCollector OTLP/gRPC endpoint.
SERVICE_VERSIONdevnoservice.version.
ENVIRONMENTlocalnodeployment.environment.name.

cmd/a2a​

Read-only A2A (Agent2Agent) agent, JSON-RPC 2.0 over HTTP, Agent Card at /.well-known/agent-card.json (ADR 0010). Starts no relay, consumer or janitor and never dials Kafka. Source: cmd/a2a/main.go, cmd/a2a/telemetry.go.

VariableDefaultRequired?Meaning
A2A_ADDR:8093noListen address of the A2A server.
A2A_AGENT_URLnoneyesAbsolute http(s) URL of this agent's JSON-RPC endpoint, advertised on the Agent Card (for example http://<release>-a2a.<ns>.svc.cluster.local:8093/). Missing, relative or schemeless = boot error before telemetry, any connection and the listener.
DATABASE_URLnoneyesPostgres DSN. Missing = boot error DATABASE_URL is required: this context runs on real Postgres. All boot problems are reported together. Runs the embedded migrations at start, like cmd/mcp.
MIGRATIONS_DATABASE_URLvalue of DATABASE_URLnoDirect DSN for the boot migrations only.
LOG_LEVELinfonoAs in cmd/api.
OTEL_SERVICE_NAMEoffer-availability-a2anoservice.name of spans and metrics.
OTEL_EXPORTER_OTLP_ENDPOINTlocalhost:4317noCollector OTLP/gRPC endpoint.
SERVICE_VERSIONdevnoservice.version; also the version printed on the Agent Card.
ENVIRONMENTlocalnodeployment.environment.name.

Compiled-in settings (not configurable)​

These are constants in the source; changing them needs a code change.

SettingValueSource
HTTP ReadHeaderTimeout5 s (all three binaries)cmd/*/main.go, cmd/api/config.go
HTTP graceful shutdown timeout / per-worker drain timeout10 s / 10 s (cmd/api); 10 s (cmd/mcp, cmd/a2a)cmd/api/config.go (shutdownTimeout, workerDrainTimeout)
Postgres pool10 connections, statement_timeout = 10sinternal/adapters/outbound/postgres/pool.go
Boot retry (migrations, first ping)5 attempts, backoff 1 s, 2 s, 4 s, 8 sinternal/bootretry/bootretry.go
Outbox relay batch size100 rows per passinternal/adapters/outbound/outbox/relay.go (DefaultBatchSize)
Kafka produceracks=all, hash balancer on the message key, 10 ms batch timeout, AllowAutoTopicCreationinternal/adapters/outbound/kafka/writer.go, relay_sink.go
Consumer retry backoff200 ms doubling to a 5 s cap, then the dead-letter topic <topic>.dlqinternal/adapters/inbound/kafka/kafka.go, deadletter.go
/readyz verdict cache and check timeout3 s cache, 2 s per round of checksinternal/adapters/inbound/http/readiness.go
Request body limit64 KiBinternal/adapters/inbound/http/response.go (maxBodyBytes)
Idempotency-Keylength at most 200, stored 24 hoursinternal/adapters/inbound/http/idempotency.go
Inventory feed sizeat most 10000 linesinternal/domain/feed/feed.go (MaxLines)
Pack quantity ceiling1000000internal/domain/catalog/packaging.go (MaxPackQuantity)
Topic producedretailnetwork.offer-availability.eventsinternal/adapters/outbound/kafka/encoder.go
Topic consumedretailnetwork.node-topology.events (dead letters to retailnetwork.node-topology.events.dlq)internal/adapters/inbound/kafka/node_consumer.go

What is deliberately absent​

  • No auth variables. REST, MCP and A2A are unauthenticated; access control is the in-cluster ClusterIP boundary.
  • No *_MODE variables. There is no in-memory runtime; the chart refuses a *_MODE entry in extraEnv.
  • No CORS, rate-limit or feature-flag variables.
  • Chart values. charts/offer-availability maps these variables onto the pods (database.*, kafka.brokers, config.*, otel.*); see Runtime and the Runbook.