Skip to content

Environment Variables ​

Complete reference for every environment variable used across the Gatez platform. Variables are grouped by service. Defaults are sourced from docker-compose.yml, .env.example, and from_env() / std::env::var() patterns in service source code.

.env File Variables ​

These variables are defined in .env (copied from .env.example) and referenced by docker-compose.yml:

VariableDefaultRequiredDescription
GATEZ_ENVlocal (compose)Yes on a host / K8sEnvironment mode: local, staging or production (trimmed, case-insensitive; demo = staging, prod = production). Controls logging level, secret validation and the dev conveniences. Unset, empty or unrecognised values (prd, uat…) fail closed as production (W2-D7-30): no proxy-header trust, no dev auth bypass, default secrets refused, no ephemeral STS key, no localhost issuer — the service logs an error naming the raw value. Only an explicit local grants the conveniences. Compose sets local by default; the prod overlay requires `staging
GATEZ_ALLOW_DEFAULT_SECRETS(unset)Notrue lets a throwaway test rig (CI's staging-mode side container) start with default secrets. Logged at error level on every start; scripts/env-guard.sh refuses it on a host. Never set it in a deployment (W2-D7-66).
GATEZ_ISSUER(empty)Hosts (recommended)Session issuer and discovery URL (W1-D1-05): the Control Plane API's public https URL, e.g. https://api.gatez.dev. Unset = http://localhost:4001 locally; on a host new sessions keep the legacy bare issuer gatez and /.well-known/openid-configuration answers 404 until it is set. Passed to the control plane and both gateways; every verifier accepts exactly this deployment's issuer, so setting it on a host ends the sessions minted before (one re-login)
ZITADEL_ADMINadminNoZitadel admin console username
ZITADEL_ADMIN_PASSWORDAdmin123!NoZitadel admin console password (first-instance human admin admin; sso profile only)
CLICKHOUSE_PASSWORD(empty)NoClickHouse default user password — leave empty: the compose server enforces none and a non-empty value makes migrate refuse the stack (W2-D7-15 adds real credentials)
GF_SECURITY_ADMIN_PASSWORDadminNoGrafana admin console password
LITELLM_MASTER_KEYsk-local-dev-keyYesMaster API key for AI Gateway authentication
OPENAI_API_KEY(empty)NoOpenAI API key; enables gpt-4o and gpt-4o-mini models
ANTHROPIC_API_KEY(empty)NoAnthropic API key; enables claude-sonnet model
GEMINI_API_KEY(empty)NoGoogle Gemini API key; enables gemini-flash model
GROQ_API_KEY(empty)NoGroq API key; enables Groq models
MISTRAL_API_KEY(empty)NoMistral API key; enables Mistral models
DEEPSEEK_API_KEY(empty)NoDeepSeek API key; enables DeepSeek models
TOGETHER_API_KEY(empty)NoTogether AI API key; enables Together models
COHERE_API_KEY(empty)NoCohere API key; enables Cohere models
FIREWORKS_API_KEY(empty)NoFireworks API key; enables Fireworks models
AZURE_OPENAI_API_KEY(empty)NoAzure OpenAI API key; enables Azure-hosted OpenAI models
AZURE_OPENAI_BASE_URL(empty)NoAzure OpenAI base URL; required when using Azure OpenAI
VLLM_BASE_URL(empty)NovLLM base URL; enables self-hosted vLLM models
MODEL_ALIASES(empty)NoModel alias configuration; maps custom names to provider models
REDIS_URLredis://redis:6379NoRedis connection URL (used as base reference)
REDIS_PASSWORDgatez-redis-devYesRedis authentication password; required for APISIX rate limiting plugins
APISIX_ADMIN_KEYedd1c9f034335f136f87ad84b625c8f1Hosts (prod overlay)APISIX Admin API authentication key
DOMAINgatez.devNoBase domain for production deployment. Used by Caddy for TLS certificates and by portal Dockerfiles for Zitadel/API URLs.

Portal runtime configuration ​

The portals carry nothing baked in. At container start nginx writes /config.json from these variables (validated by the entrypoint; the container refuses bad values and names the variable):

VariableDefaultDescription
GATEZ_API_URLhttp://localhost:4001Control Plane API base URL (https required except on localhost); also derives the CSP connect-src
GATEZ_JAEGER_ENABLEDfalseParsed into /config.json as jaeger_enabled; the Operator Portal shows the Traces navigation item and /traces route only when it is true (W2-D7-13). Compose does not pass it yet — set it on the portal services (and in the host .env) where Jaeger is reachable at /jaeger
GATEZ_SSO_ENABLEDfollows GATEZ_SSO_FEDERATIONShow the SSO button; needs GATEZ_SSO_CLIENT_ID
GATEZ_SSO_PROVIDER / GATEZ_SSO_URL / GATEZ_SSO_REALMzitadel / http://localhost:8085 / gatewayIdentity provider details (https required off-localhost)
GATEZ_SSO_CLIENT_IDZITADEL_OPERATOR_CLIENT_ID / ZITADEL_DEVELOPER_CLIENT_IDOIDC client id per portal
GATEZ_AGENT_IDENTITYfalseShows the agent-identity pages when the server flag is on
GATEZ_STDIO_ALLOWED_CMDS(empty = stdio servers disabled)Agent Gateway: exact stdio_cmd lines an operator permits, one per line (commas belong to the command). Registry writes are platform-admin only; a stored stdio server whose command leaves the list answers 403 on tools/call. Read at start-up — a change needs a restart, which also stops running stdio children. Prefer pinned, pre-installed binaries over npx … on-prem (W2-D7-63)

The only remaining build argument is VITE_TEST_AUTH (E2E mock auth); compose pins it to empty and the image records it as label io.gatez.test-auth, which the tests refuse when non-empty. Full table and rules: Authentication.

etcd ​

VariableDefaultRequiredDescription
(configured via CLI flags)----etcd is configured with command-line arguments in docker-compose.yml, not environment variables

Relevant CLI flags: --advertise-client-urls=http://etcd:2379, --listen-client-urls=http://0.0.0.0:2379, --data-dir=/etcd-data.


APISIX (L1 - API Gateway) ​

APISIX is configured via layers/api-gateway/config/apisix.yaml mounted into the container. It does not use environment variables directly. The APISIX Admin API key is set in the YAML config file.

ConfigurationValueLocation
Admin API keyedd1c9f034335f136f87ad84b625c8f1apisix.yaml and .env (APISIX_ADMIN_KEY)
etcd hosthttp://etcd:2379apisix.yaml
Proxy listen port9080apisix.yaml
Admin listen port9180apisix.yaml

Redis ​

VariableDefaultRequiredDescription
(configured via CLI flags)----Redis is configured with command-line arguments

Relevant CLI flags: --maxmemory 512mb, --maxmemory-policy volatile-lru (only keys with a TTL are evictable; durable auth state is not), --appendonly yes --appendfsync everysec on the redis-data volume (the prod overlay adds RDB snapshots).

External port: 6380 (mapped from internal 6379).


Zitadel ​

VariableDefaultRequiredDescription
ZITADEL_ADMINadminNoAdmin console username
ZITADEL_ADMIN_PASSWORDAdmin123!NoAdmin console password
ZITADEL_EXTERNALSECUREfalseNoDisable TLS requirement (required for local dev)
ZITADEL_EXTERNALPORT8085NoExternal port for Zitadel

Zitadel CLI flags: start-from-init --masterkey "MasterkeyNeedsToHave32Chars".

External port: 8085 (mapped from internal 8080). Health endpoint: /debug/healthz.


ClickHouse ​

VariableDefaultRequiredDescription
CLICKHOUSE_DBgatewayNoDefault database name, created on startup
CLICKHOUSE_DEFAULT_ACCESS_MANAGEMENT1NoEnable SQL-driven access management

External ports: 8123 (HTTP), 9000 (native), 9363 (Prometheus metrics).


Qdrant ​

Qdrant uses default configuration. No environment variables are set in docker-compose.yml.

External ports: 6333 (HTTP/REST), 6334 (gRPC).


AI Gateway (L2) ​

Source: layers/ai-gateway/src/config.rs GatewayConfig::from_env().

VariableDefaultRequiredDescription
PORT4000NoHTTP listen port
REDIS_URLredis://redis:6379NoRedis connection URL for caching and rate limits
QDRANT_URLhttp://qdrant:6334NoQdrant vector DB URL for semantic cache
CLICKHOUSE_URLhttp://clickhouse:8123NoClickHouse HTTP URL for logging
OTEL_EXPORTER_OTLP_ENDPOINThttp://otel-collector:4317NoOpenTelemetry Collector gRPC endpoint
OTEL_SERVICE_NAMEai-gatewayNoService name for OTel traces and metrics
OTEL_RESOURCE_ATTRIBUTESservice.name=ai-gatewayNoOTel resource attributes
OPENAI_API_KEY(empty)NoOpenAI API key; enables gpt-4o, gpt-4o-mini
ANTHROPIC_API_KEY(empty)NoAnthropic API key; enables claude-sonnet
GEMINI_API_KEY(empty)NoGoogle Gemini API key; enables gemini-flash
GROQ_API_KEY(empty)NoGroq API key; enables Groq models
MISTRAL_API_KEY(empty)NoMistral API key; enables Mistral models
DEEPSEEK_API_KEY(empty)NoDeepSeek API key; enables DeepSeek models
TOGETHER_API_KEY(empty)NoTogether AI API key; enables Together models
COHERE_API_KEY(empty)NoCohere API key; enables Cohere models
FIREWORKS_API_KEY(empty)NoFireworks API key; enables Fireworks models
AZURE_OPENAI_API_KEY(empty)NoAzure OpenAI API key; enables Azure-hosted OpenAI models
AZURE_OPENAI_BASE_URL(empty)NoAzure OpenAI base URL; required when using Azure OpenAI
VLLM_BASE_URL(empty)NovLLM base URL; enables self-hosted vLLM models
MODEL_ALIASES(empty)NoModel alias configuration; maps custom names to provider models
OLLAMA_BASE_URLhttp://host.docker.internal:11434NoOllama base URL for local LLM (always enabled)
LITELLM_MASTER_KEY(none)YesMaster API key; gateway refuses to start if empty
CACHE_TTL_SECS3600NoCache entry time-to-live in seconds
SEMANTIC_CACHE_ENABLEDfalseNoEnable Qdrant-based semantic similarity cache
SIMILARITY_THRESHOLD0.95NoCosine similarity threshold for cache hits (0.0-1.0)
PII_REDACTION_ENABLEDtrueNoEnable PII scanning before LLM calls
ZITADEL_URLhttp://gw-zitadel:8080NoZitadel base URL for token introspection (fallback when JWKS unavailable)
ZITADEL_CLIENT_IDapisix-clientNoZitadel client ID for token introspection
ZITADEL_CLIENT_SECRETapisix-client-secretNoZitadel client secret for token introspection
RUST_LOGai_gateway=infoNoRust log level filter
RUST_TLS_CERT(empty)NoPath to TLS certificate file; when set, enables HTTPS instead of HTTP
RUST_TLS_KEY(empty)NoPath to TLS private key file; required when RUST_TLS_CERT is set
RUST_TLS_CA(empty)NoPath to CA certificate for client verification; enables mTLS when set
GUARD_ENABLEDtrueNoEnable multi-layer prompt guard pipeline (regex + webhook). When enabled, all chat completions are scanned before reaching the LLM.
GUARD_WEBHOOK_URL(empty)NoExternal webhook URL for custom prompt guard. Receives POST with prompt, returns {"action":"reject"} to block.
GUARD_WEBHOOK_TIMEOUT_MS3000NoTimeout for guard webhook calls in milliseconds
OBSERVABILITY_WEBHOOK_ENABLEDfalseNoEnable LLM event webhook (sends batched events to external observability tool like Langfuse/LangSmith)
OBSERVABILITY_WEBHOOK_URL(empty)NoWebhook URL for LLM observability events. Receives batched POST with model, tokens, latency, cache_hit.
LANGFUSE_HOST(empty)NoLangfuse host URL for native observability export. When set with PUBLIC_KEY and SECRET_KEY, enables automatic generation-level trace export to Langfuse. Example: https://cloud.langfuse.com or self-hosted instance.
LANGFUSE_PUBLIC_KEY(empty)NoLangfuse public API key for authentication. Required when LANGFUSE_HOST is set.
LANGFUSE_SECRET_KEY(empty)NoLangfuse secret API key for authentication. Required when LANGFUSE_HOST is set. Never log or expose in responses.
LANGSMITH_API_KEY(empty)NoLangSmith API key for native observability export. When set, enables automatic run-level trace export to LangSmith (LangChain). Format: lsv2_*.
LANGSMITH_ENDPOINThttps://api.smith.langchain.comNoLangSmith API endpoint. Defaults to LangChain's hosted service. Override for self-hosted LangSmith instances.
LANGSMITH_PROJECTgatezNoLangSmith project name for grouping traces. All LLM events are tagged with this project.
CONFIG_WATCH_PATHS(empty)NoComma-separated file paths to watch for changes. Triggers hot config reload via /admin/reload when files change. Polling-based (no inotify dependency).
TRUST_PROXY_AUTH_HEADERS(unset)NoWhether requests carrying x-tenant-id/x-userinfo but no bearer token may be authenticated from those headers alone. Forced ON only for an explicit GATEZ_ENV=local (unset or unrecognised fails closed, W2-D7-30);

:::note The docker-compose.yml overrides SEMANTIC_CACHE_ENABLED to true and QDRANT_URL to http://qdrant:6333 (HTTP port, not gRPC). The code default uses port 6334 (gRPC), but the compose environment takes precedence. :::


Agent Gateway (L3) ​

Source: layers/agent-gateway/src/config.rs AgentGatewayConfig::from_env().

VariableDefaultRequiredDescription
PORT5000NoHTTP listen port (mapped to external 5001)
REDIS_URLredis://gw-redis:6379NoRedis connection URL for session state
CLICKHOUSE_URLhttp://clickhouse:8123NoClickHouse HTTP URL for audit logging
AI_GATEWAY_URLhttp://ai-gateway:4000NoAI Gateway URL for LLM calls from agents
OTEL_EXPORTER_OTLP_ENDPOINThttp://otel-collector:4317NoOpenTelemetry Collector gRPC endpoint
OTEL_SERVICE_NAMEagent-gatewayNoService name for OTel traces and metrics
OTEL_RESOURCE_ATTRIBUTESservice.name=agent-gatewayNoOTel resource attributes
SESSION_TTL_SECS3600NoDefault agent session TTL in seconds
MAX_CONCURRENT_TOOLS10NoMaximum concurrent tool executions per session
GATEZ_BUILD_SHA(empty)NoGit sha of the image, shown as build.sha by every service's /health and the control plane's /api/health (W2-D8-09). Set by CI as an image build arg (Dockerfile ARG → ENV; an owner edit). Unset = null, never invented.
GATEZ_BUILT_AT(empty)NoBuild time (RFC 3339) shown as build.built_at. Same source as GATEZ_BUILD_SHA.
GATEZ_OPERATOR_PORTAL_URLhttp://localhost:3003NoBase of the Operator Portal; the hitl_pending webhook's portal_url deep link is <base>/approvals/<approval_id> (W2-D8-08).
GATEZ_DEVELOPER_PORTAL_URLhttp://localhost:3004NoBase of the Developer Portal; a tenant's own hitl_pending hooks link there (<base>/approvals/<approval_id>).
GATEZ_WEBHOOK_SECRET(empty)NoWhen set, outbound webhooks carry X-Gatez-Timestamp and X-Gatez-Signature (HMAC-SHA256 over <timestamp>.<body>).
HITL_WEBHOOK_URL(empty)NoWebhook URL for human-in-the-loop approval notifications
ZITADEL_URLhttp://gw-zitadel:8080NoZitadel base URL for token introspection (fallback when JWKS unavailable)
ZITADEL_CLIENT_IDapisix-clientNoZitadel client ID for token introspection
ZITADEL_CLIENT_SECRETapisix-client-secretNoZitadel client secret for token introspection
RUST_LOGagent_gateway=infoNoRust log level filter
RUST_TLS_CERT(empty)NoPath to TLS certificate file; when set, enables HTTPS instead of HTTP
RUST_TLS_KEY(empty)NoPath to TLS private key file; required when RUST_TLS_CERT is set
RUST_TLS_CA(empty)NoPath to CA certificate for client verification; enables mTLS when set
MCP_HEALTH_CHECK_INTERVAL_SECS30NoInterval between MCP server health checks in seconds. Set to 0 to disable health checks.
MCP_EXCLUDE_UNHEALTHYfalseNoWhen true, unhealthy MCP servers are excluded from tool discovery. Prevents routing tool calls to degraded servers.
MCP_OAUTH_ENABLEDfalseNoEnable MCP OAuth per RFC 9728 + RFC 8414. When enabled, the gateway acts as an OAuth proxy for MCP clients.
MCP_OAUTH_ISSUER(empty)NoOAuth issuer URL (typically Zitadel organization URL). Used in .well-known/oauth-authorization-server response.
MCP_OAUTH_JWKS_URL(empty)NoJWKS endpoint for MCP token validation. Proxied via /v1/mcp/auth/jwks.
MCP_OAUTH_MODEpermissiveNoToken validation mode: strict (require token), optional (validate if present), permissive (skip validation).
MCP_OAUTH_RESOURCE_URL(empty)NoProtected resource URL for RFC 9728 metadata.
MCP_OAUTH_SCOPES(empty)NoComma-separated OAuth scopes required for MCP access.
CONFIG_WATCH_PATHS(empty)NoComma-separated file paths to watch for config changes. Triggers hot reload via /admin/reload.

Control Plane API ​

Source: layers/control-plane-api/src/clients.rs, main.rs, middleware.rs.

VariableDefaultRequiredDescription
GATEZ_SSO_FEDERATIONfalseNoExplicit switch for IdP (Zitadel) tokens. false (core default): only built-in Gatez sessions are accepted and any identity-provider bearer is refused with 401 sso_not_configured. Set true only with the sso compose profile. The same variable is read by the AI Gateway and the Agent Gateway.
GATEZ_ISSUER(empty)Hosts (recommended)See the .env table: issuer for new sessions and the /.well-known/openid-configuration document; must be an absolute https URL outside GATEZ_ENV=local (the service refuses to start otherwise)
KEYCLOAK_JWKS_URLhttp://gw-zitadel:8080/oauth/v2/keysWith federationJWKS endpoint used to verify IdP tokens when GATEZ_SSO_FEDERATION=true (name kept for back-compat; the IdP is Zitadel). Ignored when federation is off.
REDIS_URLredis://127.0.0.1:6379NoRedis connection URL
APISIX_ADMIN_URLhttp://localhost:9180NoAPISIX Admin API base URL
APISIX_ADMIN_KEYedd1c9f034335f136f87ad84b625c8f1Hosts (prod overlay)APISIX Admin API key (warning logged if using default)
CLICKHOUSE_URLhttp://localhost:8123NoClickHouse HTTP URL for analytics queries
AGENT_GATEWAY_URLhttp://localhost:5001NoAgent Gateway URL for agent management
ALLOWED_ORIGINShttp://localhost:3003,http://localhost:3004NoComma-separated CORS allowed origins
MASTER_KEYsk-local-dev-keyNoMaster API key for service-to-service auth
ZITADEL_URLhttp://localhost:8085NoZitadel base URL for JWT introspection (fallback when JWKS unavailable)
ZITADEL_CLIENT_IDapisix-clientNoZitadel client ID for JWT introspection
ZITADEL_CLIENT_SECRETapisix-client-secretNoZitadel client secret for JWT introspection
RUST_LOGcontrol_plane_api=infoNoRust log level filter
ENVIRONMENT(removed)NoSuperseded by GATEZ_ENV=local (W2-D7-30): manual provider API-key entry is allowed only on a local developer machine; compose no longer sets ENVIRONMENT=development
GATEZ_LICENSE_KEY(none)NoLicense key JWT. Without it, the platform runs in Community tier. Generate with scripts/generate-license.sh. A valid key's tenant_limit (> 0) is enforced on POST /api/tenants → 403 tenant_limit_reached (W2-D8-06); Community has no cap yet.
RUST_TLS_CERT(empty)NoPath to TLS certificate file; when set, enables HTTPS instead of HTTP
RUST_TLS_KEY(empty)NoPath to TLS private key file; required when RUST_TLS_CERT is set
RUST_TLS_CA(empty)NoPath to CA certificate for client verification; enables mTLS when set
VAULT_TOKEN(empty)NoHashiCorp Vault token for secret resolution. Used when provider key source is vault.
VAULT_CACHE_TTL_SECS300NoCache TTL for Vault secret lookups in seconds (default 5 min). Reduces Vault API calls.
ATTIO_DEMO_WEBHOOK_URL(empty)NoAttio workflow webhook URL for the public /api/demo-request lead-capture endpoint (gatez.dev "Request a demo" form). Treat as a secret — set in the host .env only, never commit. When empty, demo requests return 503 and a warning is logged at startup (fine for local dev).

:::note In docker-compose.yml, the Control Plane API uses Docker-internal hostnames (e.g., http://apisix:9180, http://gw-zitadel:8080). The code defaults use localhost with external ports for local development without Docker. :::


Jaeger ​

VariableDefaultRequiredDescription
COLLECTOR_OTLP_ENABLEDtrueNoEnable OTLP trace ingestion

External ports: 16686 (UI), 14268 (HTTP collector).


OpenTelemetry Collector ​

Configured via infra/otel/config.yaml mounted into the container. No environment variables are set in docker-compose.yml.

External ports: 4317 (OTLP gRPC), 4318 (OTLP HTTP), 8889 (Prometheus metrics).


Prometheus ​

Configured via infra/prometheus/prometheus.yml. CLI flags: --storage.tsdb.retention.time=15d.

External port: 9090.


Grafana ​

VariableDefaultRequiredDescription
GF_SECURITY_ADMIN_USERadminNoGrafana admin username
GF_SECURITY_ADMIN_PASSWORDadminNoGrafana admin password. Can be overridden via environment variable for production deployments.
GF_INSTALL_PLUGINSgrafana-clickhouse-datasourceNoPlugins to install on startup

External port: 3002 (mapped from internal 3000).

WARNING

Change GF_SECURITY_ADMIN_PASSWORD from the default admin value before deploying to production. Set it via environment variable in your deployment environment.


Mock Backend ​

No environment variables. Uses the httpbin image for testing.

External port: 8000 (mapped from internal 80).


Landing Page ​

No environment variables. Static nginx serving landing-page/ directory.

External port: 8899 (mapped from internal 80).

Tenant guard config (PUT /api/tenants/:id/guard-config, read by the AI gateway) ​

  • mode (W2-D7-38): strict — every pattern match rejects (mask patterns escalate to reject) and an unreachable guard webhook rejects the request; moderate (default) — each pattern keeps its action (reject prompt injection, mask PII) and a webhook outage fails open; permissive — matches are logged by pattern name and never block or mask. Any other value reads as moderate.
  • Pattern action: pass | reject | mask (canonical). The legacy block (= reject) and log (= pass) are still accepted on read and on write, so stored configs keep working; the Guards tab moves to the canonical names in W2-D7-38.b. Unknown actions are refused with 400 invalid_guard_action.
  • A blank webhook_url means "not set" — the global GUARD_WEBHOOK_URL applies. In strict mode the inherited global webhook also fails closed: an outage of that webhook answers 503 guard_unavailable for every strict tenant that uses it (retry later; counted in guard_rejections_by_tenant).
  • Guard settings are written by platform operators only (PUT answers 403 for tenant users); tenants read their own.
  • A stored config that does not parse is logged by the AI gateway at error level with the tenant id; the global guard config applies until it is fixed. Before this it was dropped silently.

Enterprise API + AI + Agent Gateway