Skip to main content

Configuration

IAM reads a config file (config.yaml/.json/.toml) from $CONFIG_PATH (a directory or an exact file), and every key can be overridden by an environment variable. The env name is the upper-snake path prefixed with IAM_:

service.auth.encryption_key → IAM_SERVICE_AUTH_ENCRYPTION_KEY
infra.postgres.password → IAM_INFRA_POSTGRES_PASSWORD

Env variables win over file values, so production can run the image with no config file at all — just IAM_* env.

Required in production​

VariablePurpose
IAM_SERVICE_HTTP_PUBLIC_URLabsolute base URL this deployment is reachable at (e.g. https://auth.example.com, no trailing slash). It is the OIDC issuer prefix and every absolute URL in the discovery document. The service refuses to start without it.
IAM_SERVICE_AUTH_ENCRYPTION_KEYbase64 32-byte AES-256 key; encrypts reversible secrets at rest. The service refuses to start without it.
IAM_SERVICE_AUTH_MASTER_KEYoperator credential for the admin panel + /mgmt/v1/* API. Empty disables the masterKey scheme.
IAM_INFRA_POSTGRES_*Postgres connection (below)

Generate the encryption key once and keep it secret and stable — rotating it without re-encrypting existing secrets makes them unreadable:

openssl rand -base64 32

Postgres​

VariableDefaultNotes
IAM_INFRA_POSTGRES_HOSTlocalhost
IAM_INFRA_POSTGRES_PORT5432
IAM_INFRA_POSTGRES_USERNAMEiam
IAM_INFRA_POSTGRES_PASSWORDiamoverride in prod
IAM_INFRA_POSTGRES_DATABASEiam
IAM_INFRA_POSTGRES_SSLMODErequiredisable|require|verify-ca|verify-full
IAM_INFRA_POSTGRES_LOG_LEVELinfodebug|info|warn|error

HTTP server​

VariableDefaultNotes
IAM_SERVICE_HTTP_ADDR:8080API + admin SPA
IAM_SERVICE_HTTP_PUBLIC_URL—required. Public origin (+ optional path prefix) clients reach IAM at. Issuer = {public_url}/p/{project_id}/e/{env}. Deliberately never derived from Host / X-Forwarded-*: a request header must not be able to decide the issuer clients pin.
IAM_SERVICE_HTTP_PROBE_ADDR:8081probe listener; set =ADDR (or :8080) to mount /healthz/* on the API port
IAM_SERVICE_HTTP_READ_TIMEOUT_SEC15
IAM_SERVICE_HTTP_WRITE_TIMEOUT_SEC30
IAM_SERVICE_HTTP_SHUTDOWN_SEC15graceful drain
IAM_SERVICE_HTTP_METRICS_ENABLEDtrueserves a Prometheus scrape endpoint at /metrics on the probe listener — see Observability
IAM_SERVICE_HTTP_TRUSTED_PROXIES[]CIDRs/IPs of your LB/ingress to trust for X-Forwarded-For. Empty = use the real TCP peer, so clients can't spoof IPs to dodge IP-keyed rate limits. Set this when behind a proxy.

Logging & CORS​

VariableDefaultNotes
IAM_SERVICE_LOGGER_LEVELinfodebug|info|warn|error
IAM_SERVICE_LOGGER_FORMATjsonjson|text
IAM_SERVICE_CORS_ALLOWED_ORIGINS[]* or comma-separated origins

Dev conveniences​

VariableDefaultNotes
IAM_SERVICE_AUTH_SEED_ROOTfalseensure a Root project exists on startup so the operator has something to manage

Browser session lifetime​

The session the hosted provider screens establish is a pair of HttpOnly cookies, and both lifetimes come from the project's session_policy, not from the service config:

CookieMax-AgeScope
iam_sessionsession_policy.access_ttl (default 10m)/
iam_refreshsession_policy.refresh_ttl (default 30d)/v1/auth/token/refresh

The access cookie is short by design; the refresh cookie is what keeps a person signed in, so refresh_ttl is the knob that decides how often an operator is sent back to a login screen. Raise it for an internal console; lower it for anything handling sensitive data. Both are set per project (and per environment) through the admin API, so live and test can differ.

Note on TTLs and environment​

Token TTLs are not service config — access/refresh TTLs come from each project's session_policy config doc (set via the admin API), and the acting environment is chosen per request via the X-Environment header. See Projects & environments and Admin & config.

Example config file​

# config.yaml — every key is also an IAM_* env var
infra:
postgres:
host: db
password: ${POSTGRES_PASSWORD}
sslmode: require
service:
http:
addr: ":8080"
public_url: "https://auth.example.com" # required; OIDC issuer base
trusted_proxies: ["10.0.0.0/8"]
auth:
master_key: "" # prefer IAM_SERVICE_AUTH_MASTER_KEY
encryption_key: "" # prefer IAM_SERVICE_AUTH_ENCRYPTION_KEY