Skip to main content

Environment variables

Complete reference of internal/config.Load's environment-variable surface — nothing here is inferred; every entry below is read directly from internal/config/profile.go.

General

VariableDefaultPurpose
CNS_HTTP_ADDR:8080Listen address.
CNS_ENVdevDeployment environment name — stamped onto every event's source.environment and used as the AWS SSM secrets path segment (/cns/<env>/...).
CNS_DEFAULT_TENANT_IDkatyayani (shipped default — set your own)Phase-1 single-tenant shortcut: seeds tenant.Resolver's allow-list, so a token asserting any other tenant is rejected.
CNS_ADMIN_BOOTSTRAP_SUBJECT(unset)Grants platform-operator to this one subject_id at boot — the only way to escape the RBAC bootstrap deadlock.
CNS_ADMIN_STATE_PATH(unset = in-memory)Path to a durable JSON snapshot for admin-API state (tenants, apps, policies, RBAC, audit). Unset means every admin mutation is lost on restart.
CNS_IDENTITY_STATE_PATHvar/identities.jsonIdentity-map state path.
CNS_OPERATOR_BOOTSTRAP_EMAIL(unset)Read at boot; see source for current wiring.
CNS_TENANT_ADMIN_BOOTSTRAP_EMAIL(unset)Read at boot; see source for current wiring.

Store

VariablePurpose
CNS_CLICKHOUSE_ENDPOINTPresence alone selects the clickhouse store implementation.
CNS_CLICKHOUSE_DATABASEClickHouse database name.
CNS_CLICKHOUSE_TABLEClickHouse events table name.
CNS_CLICKHOUSE_USERNAMEClickHouse auth.
CNS_CLICKHOUSE_PASSWORDClickHouse auth.
CNS_STORE_IMPL=memoryOnly consulted when CNS_CLICKHOUSE_ENDPOINT is unset — selects the in-process, non-persistent store (dev/test only; required for the dev fixture).

Neither set → noop (every store call returns "not implemented").

Realtime

VariablePurpose
CNS_CENTRIFUGO_ADDRPresence alone selects the centrifugo realtime implementation.
CNS_CENTRIFUGO_API_KEYCentrifugo HTTP API key.

Unset → noop, which fails AuthorizeSubscribe closed — see Realtime & streaming for what that means for GET /v1/stream.

Identity

VariablePurpose
CNS_SSO_JWT_HMAC_SECRETStatic HMAC signing secret. Presence selects sso-jwt via HMAC.
CNS_SSO_JWT_JWKS_URLJWKS endpoint. Presence selects sso-jwt via JWKS (checked only if the HMAC secret is unset).
CNS_SSO_JWT_ISSUERExpected iss claim.
CNS_SSO_JWT_AUDIENCEExpected aud claim.
CNS_SSO_JWT_STATIC_TENANT_IDFallback tenant id when the token carries no tenant claim (e.g. a non-native IdP — see Wiring a non-native IdP).
CNS_SSO_JWT_CLAIM_TENANT_IDOverride the claim name read for tenant id.
CNS_SSO_JWT_CLAIM_EMAILOverride the claim name read for email.
CNS_SSO_JWT_CLAIM_PHONEOverride the claim name read for phone.

Neither signing-key variable set → noop (every request is unauthenticated-fails).

Secrets

VariableDefaultPurpose
CNS_SECRETS_IMPLssmssm (AWS SSM, ed25519 local-sign), memory (in-process keystore — no AWS calls at all, required for the dev fixture), or noop.

The env setting passed to the secrets adapter is always CNS_ENV's value — not a separate variable.

Dev fixture only

These are never meant for a real deployment — setting CNS_DEV_FIXED_SUBJECT_ID outside a fixture would collapse every distinct identity onto the same subject_id.

VariablePurpose
CNS_DEV_FIXTURE=1Enables the dev-fixture guard rail (see Profiles & adapter selection) — Load refuses to boot unless the rest of the config is provably harmless (loopback address, CNS_ENV=dev, store/secrets = memory, realtime = noop).
CNS_DEV_FIXED_SUBJECT_IDRequires CNS_DEV_FIXTURE=1. Pins identity-map resolution to always return this literal subject_id, so a fixture script can pre-compute a bootstrap subject id that's guaranteed correct.
CNS_DEV_SEED_SUBJECTIf set and the store is memory, seeds a handful of synthetic events for this subject at boot.

See The dev fixture for how scripts/dev-fixture.sh uses all three together.