Skip to main content
All TrustGate configuration is read from environment variables. In development, .env is loaded automatically via godotenv; in production, inject env vars directly (Helm values, ECS task definitions, k8s ConfigMap + Secret). Copy .env.example for the full set with safe defaults.

Server & discovery

VariableDefaultMeaning
APP_ENVdevEnvironment name.
SERVER_ADMIN_PORT8080Admin plane port.
SERVER_PROXY_PORT8081Proxy plane port.
SERVER_MCP_PORT8082MCP plane port.
SERVER_READ_TIMEOUT / SERVER_WRITE_TIMEOUT60sHTTP timeouts.
SERVER_IDLE_TIMEOUT120sIdle connection timeout.
SERVER_SECRET_KEY(required)HS256 secret for admin JWTs.
GATEWAY_BASE_DOMAINllm.neuraltrust.aiProxy host suffix ({slug}.<domain>).
MCP_BASE_DOMAINmcp.neuraltrust.aiMCP host suffix.
GATEWAY_DISCOVERY_MODEheaderheader or subdomain (see Architecture).

Datastores

VariableDefaultMeaning
DB_HOST / DB_PORTlocalhost / 5432Postgres.
DB_USER / DB_PASSWORD / DB_NAMEagentgateway / …Postgres credentials.
DB_SSL_MODEdisablePostgres SSL mode.
DB_MIN_CONNS / DB_MAX_CONNS1 / 10pgxpool bounds.
REDIS_HOST / REDIS_PORTlocalhost / 6379Redis.
REDIS_DB3Redis logical DB.
REDIS_TLS_ENABLEDfalseRedis TLS.
CACHE_LOCAL_TTL5mIn-process config cache TTL.
KAFKA_BROKERSlocalhost:9092Kafka brokers (CSV).

Telemetry, metrics & upstreams

VariableDefaultMeaning
TELEMETRY_ENABLEDtrueEmit request telemetry.
TELEMETRY_KAFKA_TOPICagentgateway.requestsTelemetry topic.
TELEMETRY_TRUSTLENS_ENABLED / _URLfalse / —TrustLens forwarding.
METRICS_ENABLEDtruePrometheus metrics.
METRICS_QUEUE_SIZE / _WORKER_COUNT / _FLUSH_INTERVAL1000 / 1 / 5sMetrics worker.
UPSTREAM_TIMEOUT60sUpstream request timeout.
UPSTREAM_ERROR_PASSTHROUGHtrueRelay provider error bodies to the client.
PROVIDER_REQUEST_TIMEOUT60sPer-provider timeout.
PROVIDER_MAX_RETRIES2Provider retry count.
OPENROUTER_API_KEYModel-catalog sync.
LOG_LEVEL / LOG_FORMATINFO / jsonLogging.
See .env.example in the repo for the complete list, including the CORS_* server-level CORS and playground/STS signing variables.

Migrations

Database migrations are in-code Go files under pkg/infra/database/migrations/, named <unix_timestamp>_<snake_name>.go, each registering itself in init(). The Admin plane applies any pending migrations automatically on boot — each migration’s DDL and its version row commit in a single transaction.