Skip to main content

Configuration

product-content ships three binaries, cmd/api, cmd/mcp and cmd/a2a, all 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 (all three binaries) and real Kafka (cmd/api only) with no in-memory mode. Mandatory variables are validated before anything is opened or bound; a missing one is a boot error that names it (see Troubleshooting).

The variables are read in cmd/api/config.go, cmd/api/main.go, cmd/api/telemetry.go, cmd/mcp/main.go, cmd/mcp/telemetry.go, cmd/a2a/main.go and, for the telemetry resource, internal/adapters/outbound/telemetry/telemetry.go. No other package reads the environment. There are no test-only variables (the integration tests start their own containers).

cmd/api​

REST, the transactional outbox relay and the offer-availability consumer in one process.

VariableDefaultRequired?Meaning
HTTP_ADDR:8080noListen address of the REST server (also serves /healthz and /readyz). The chart keeps service.targetPort equal to its port.
DATABASE_URLnoneyesPostgres DSN. Missing = boot error DATABASE_URL is required: this context runs on real Postgres, there is no in-memory mode. Pool of at most 10 connections, statement_timeout = 5s.
MIGRATIONS_DATABASE_URLvalue of DATABASE_URLnoDirect (non-pooled, session-mode) DSN used only for the embedded boot migrations, whose advisory lock does not survive a transaction-mode pooler. Empty falls back to DATABASE_URL.
KAFKA_BROKERSnoneyesComma-separated broker list (entries trimmed, blanks dropped). Missing = boot error KAFKA_BROKERS is required: this context runs on real Kafka (outbox relay, consumers, /readyz). Used by the relay, the consumer and the /readyz broker check. Locally the single broker is localhost:9092.
OFFER_AVAILABILITY_CONSUMER_GROUPnoneyesStable Kafka consumer group id of the offer-availability consumer (topic retailnetwork.offer-availability.events). No default and no literal in the code. Missing = boot error OFFER_AVAILABILITY_CONSUMER_GROUP is required: the consumer always runs on real Kafka. Suggested value: product-content-offer-availability.
OUTBOX_RELAY_INTERVAL1snoPause between relay passes that did not fill a batch. A Go duration (500ms, 2s) 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, so a typo never removes the cap.
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, not at boot.
LOG_LEVELinfonodebug, info, warn (or warning), error, case-insensitive. Anything else silently falls back to info. Logs are JSON on stdout and carry trace_id/span_id when written inside a span.
OTEL_SERVICE_NAMEproduct-contentnoservice.name of spans and metrics, also the HTTP server span/metric name.
OTEL_EXPORTER_OTLP_ENDPOINTlocalhost:4317noCollector OTLP/gRPC endpoint, host:port or URL. Export never blocks: an unreachable Collector costs telemetry, never availability.
SERVICE_VERSIONdevnoservice.version resource attribute. The chart sets it to the image tag.
ENVIRONMENTlocalnodeployment.environment.name resource attribute, read by telemetry.Setup.

The first mandatory failure is returned alone (the checks run in the order DATABASE_URL, KAFKA_BROKERS, OFFER_AVAILABILITY_CONSUMER_GROUP).

cmd/mcp​

Read-only Model Context Protocol server over the same Postgres (MCP tools). It has no Kafka producer, consumer or relay, so it reads no KAFKA_BROKERS, OFFER_AVAILABILITY_CONSUMER_GROUP or OUTBOX_* variable; the chart never renders them into this workload.

VariableDefaultRequired?Meaning
MCP_ADDR:8090noListen address (Streamable HTTP on /mcp and /, /healthz). The chart keeps mcp.service.targetPort equal to its port.
DATABASE_URLnoneyesPostgres DSN (the same database as cmd/api). Missing = boot error DATABASE_URL is required: this context runs on real Postgres, there is no in-memory mode.
MIGRATIONS_DATABASE_URLvalue of DATABASE_URLnoDirect DSN for the embedded boot migrations; cmd/mcp applies them on start like cmd/api (idempotent).
LOG_LEVELinfonoAs cmd/api.
OTEL_SERVICE_NAMEproduct-content-mcpnoservice.name of spans and metrics. Note the -mcp default, different from cmd/api.
OTEL_EXPORTER_OTLP_ENDPOINTlocalhost:4317noCollector OTLP/gRPC endpoint.
SERVICE_VERSIONdevnoservice.version, also logged at boot.
ENVIRONMENTlocal in telemetry, dev in the boot log linenodeployment.environment.name, read by telemetry.Setup and logged at boot. The chart does not render it: set it through mcp.extraEnv.

cmd/a2a​

Read-only Agent2Agent agent over the same Postgres. It has no Kafka producer, consumer or relay, so it reads no KAFKA_BROKERS, OFFER_AVAILABILITY_CONSUMER_GROUP or OUTBOX_* variable; the chart never renders them into this workload.

VariableDefaultRequired?Meaning
A2A_ADDR:8093noListen address (JSON-RPC on / and /a2a, Agent Card, /healthz).
A2A_AGENT_URLnoneyesAbsolute http(s) URL of this agent's JSON-RPC endpoint, advertised on the Agent Card. A missing, relative or schemeless value is a boot error naming the variable. The chart defaults it to http://<release>-a2a.<ns>.svc.cluster.local:8093/.
DATABASE_URLnoneyesPostgres DSN (the same database as cmd/api). Missing = boot error DATABASE_URL is required: .... Both problems are reported together.
MIGRATIONS_DATABASE_URLvalue of DATABASE_URLnoDirect DSN for the embedded boot migrations; cmd/a2a applies them on start like cmd/api (idempotent).
LOG_LEVELinfonoAs cmd/api.
OTEL_SERVICE_NAMEproduct-content-a2anoservice.name of spans and metrics. Note the -a2a default, different from cmd/api.
OTEL_EXPORTER_OTLP_ENDPOINTlocalhost:4317noCollector OTLP/gRPC endpoint.
SERVICE_VERSIONdevnoservice.version, also advertised as the Agent Card version.
ENVIRONMENTlocalnodeployment.environment.name, read by telemetry.Setup.

Real output shape of a misconfigured start is documented in Troubleshooting.

Readiness (cmd/api)​

GET /readyz is 200 only when the shutdown drain gate is open and Postgres answers a ping and a Kafka broker answers a topic-less metadata request. The verdict is cached for 3 s and a round of checks is bounded by 2 s. /healthz is liveness only. cmd/a2a and cmd/mcp serve GET /healthz only and use it for all three probes; they have no /readyz.

Compiled-in settings (not configurable)​

SettingValueSource
HTTP ReadHeaderTimeout5 s (all three binaries)cmd/api/main.go, cmd/mcp/main.go, cmd/a2a/main.go
HTTP graceful shutdown timeout / per-worker drain timeout10 s / 10 s (cmd/api); 10 s (cmd/mcp, cmd/a2a)cmd/api/main.go (shutdownTimeout, workerDrainTimeout), cmd/mcp/main.go, cmd/a2a/main.go
Telemetry flush on shutdown5 scmd/api/telemetry.go, cmd/mcp/telemetry.go, cmd/a2a/main.go
Postgres pool size and statement timeout10 connections, statement_timeout = 5sinternal/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
Consumer retry backoff200 ms doubling to a 5 s cap; at most 5 handling attempts, then dead letter on <topic>.dlqinternal/adapters/inbound/kafka/kafka.go, deadletter.go
Transient broker-connection failures on fetchup to 10 consecutive, then the worker fails and the process exitsinternal/adapters/inbound/kafka/kafka.go (maxTransientFetchFailures)
/readyz verdict cache / check timeout3 s / 2 sinternal/adapters/inbound/http/readiness.go
Request body limit64 KiBinternal/adapters/inbound/http/response.go
Idempotency-Key length / record TTL1 to 128 characters / 24 h (idempotency.TTL, one constant for the replay read and the purge)internal/adapters/inbound/http/idempotency.go, internal/application/idempotency/idempotency.go
Idempotency-key retention looppurges at start then hourly, batches of 1000 (fixed, not configurable)cmd/api/retention.go, internal/adapters/outbound/postgres/idempotency.go (PurgeExpired)
List page size default100internal/application/usecases/queries.go (DefaultPageSize)
Topic producedretailnetwork.product-content.eventsinternal/adapters/outbound/kafka/encoder.go (Topic)
Topic consumedretailnetwork.offer-availability.eventsinternal/adapters/inbound/kafka/offer_availability.go

What is deliberately absent​

  • No auth variables. REST, MCP and A2A are unauthenticated fleet-wide; TestNoAuthMiddlewareReintroduced guards REST.
  • No *_MODE variables. Postgres and Kafka are the only runtime; the chart refuses any *_MODE entry in extraEnv.
  • No MCP write variable. cmd/mcp is read-only and reads no Kafka, relay or consumer variable.
  • No CORS, rate-limit or feature-flag variables.

Chart values​

charts/product-content maps these variables onto the pods: database.*, kafka.brokers, config.*, otel.*, mcp.* and a2a.* (see Runbook).

Chart valueVariable
config.httpAddrHTTP_ADDR
config.logLevelLOG_LEVEL (api, mcp and a2a)
config.offerAvailabilityConsumerGroupOFFER_AVAILABILITY_CONSUMER_GROUP
config.outboxRelayIntervalOUTBOX_RELAY_INTERVAL
config.outboxMaxAttemptsOUTBOX_MAX_ATTEMPTS
config.shutdownDrainDelaySHUTDOWN_DRAIN_DELAY
database.url / database.existingSecretDATABASE_URL (always from a Secret)
database.migrationsExistingSecretKey / database.migrationsUrlMIGRATIONS_DATABASE_URL
kafka.brokersKAFKA_BROKERS
otel.endpoint, otel.serviceNameOTEL_EXPORTER_OTLP_ENDPOINT, OTEL_SERVICE_NAME (mcp gets <serviceName>-mcp, a2a gets <serviceName>-a2a)
mcp.httpAddrMCP_ADDR
mcp.extraEnvextra variables of the mcp container (for example ENVIRONMENT); the chart refuses *_MODE, Kafka, outbox, consumer-group and chart-owned names
a2a.httpAddrA2A_ADDR
a2a.agentUrlA2A_AGENT_URL