Configuration

Configuration reference for the self-hosted Ingate gateway: config file, environment variables, CLI flags, and every option with its default.

Overview

This page is the configuration reference for a self-hosted Ingate gateway. On Ingate Cloud, configuration is managed for you through the dashboard at app.ingateai.com, so none of the file or environment setup below applies.

Configuration is loaded in this precedence order (highest wins):

  1. CLI flags (--port, --host)
  2. Environment variables (INGATE_SERVER_PORT)
  3. Config file (ingate.yaml)
  4. Built-in defaults

Config File Locations

Ingate searches for ingate.yaml in:

  1. Current directory (.)
  2. ~/.ingate/
  3. /etc/ingate/

Override with --config /path/to/ingate.yaml.

Environment Variable Mapping

Every config key maps to an env var with the INGATE_ prefix and _ separators:

Config KeyEnvironment Variable
server.portINGATE_SERVER_PORT
server.hostINGATE_SERVER_HOST
database.postgresql_urlINGATE_DATABASE_POSTGRESQL_URL
database.redis_urlINGATE_DATABASE_REDIS_URL
auth.enabledINGATE_AUTH_ENABLED

All Options

server

KeyTypeDefaultDescription
server.hoststring""Listen host (empty = all interfaces)
server.portint7100Listen port
server.max_body_bytesint10485760Max request body size in bytes (10MB)
server.timeout_secondsint300Upstream request timeout (5 minutes)
server.cors_originsstring""Allowed CORS origins. * for all, comma-separated for specific
server.admin_authboolfalseRequire X-Ingate-Key for /api/* and /ui/* endpoints
server.tls.cert_filestring""TLS certificate file path
server.tls.key_filestring""TLS private key file path

providers

See Providers for full documentation.

KeyTypeDefaultDescription
providers.<name>.base_urlstringrequiredUpstream API URL
providers.<name>.api_keystring""API key
providers.<name>.enabledboolfalseWhether this provider is active
providers.<name>.auth_headerstringAuthorizationCustom auth header name
providers.<name>.auth_schemestringBearerAuth value prefix
providers.<name>.path_prefixstring""Path prepended to every request
providers.<name>.query_paramsmap{}Static query parameters
providers.<name>.headersmap{}Static headers

auth

KeyTypeDefaultDescription
auth.enabledboolfalseEnable X-Ingate-Key authentication
auth.keysstring[][]List of valid API keys (stored as SHA-256 hashes internally)

rate_limit

Requires Redis.

KeyTypeDefaultDescription
rate_limit.enabledboolfalseEnable per-key rate limiting
rate_limit.requests_per_minuteint60Max requests per minute per key

fallback

KeyTypeDefaultDescription
fallback.enabledboolfalseEnable automatic provider fallback
fallback.max_retriesint1Max fallback attempts
fallback.fallback_mapmap{}Provider → fallback provider mapping

database

KeyTypeDefaultDescription
database.postgresql_urlstring""PostgreSQL connection string
database.redis_urlstring""Redis connection string

PostgreSQL URL format:

bash
postgres://user:password@host:5432/dbname?sslmode=require

Redis URL format:

bash
redis://[:password@]host:6379[/db]
rediss://[:password@]host:6380[/db]   # TLS

logging

KeyTypeDefaultDescription
logging.buffer_sizeint10000Async pipeline channel buffer
logging.workersint4Number of background writer goroutines

retention

KeyTypeDefaultDescription
retention.enabledboolfalseEnable automatic data cleanup
retention.log_retention_daysint30Days to keep logs
retention.eval_result_retention_daysint90Days to keep eval results

scheduler

KeyTypeDefaultDescription
scheduler.enabledboolfalseEnable periodic eval scheduler
scheduler.interval_secsint300Run interval (5 minutes)
scheduler.batch_sizeint100Max logs per scheduled run

Minimal Config

yamlingate.yaml
providers:
  openai:
    base_url: https://api.openai.com
    api_key: sk-...
    enabled: true
database:
  postgresql_url: postgres://ingate:pass@localhost:5432/ingate?sslmode=disable

Production Config

yamlingate.yaml
server:
  port: 7100
  max_body_bytes: 10485760
  timeout_seconds: 300
  cors_origins: "https://app.yourcompany.com"
  admin_auth: true
  tls:
    cert_file: /etc/ingate/tls/cert.pem
    key_file: /etc/ingate/tls/key.pem

providers:
  openai:
    base_url: https://api.openai.com
    api_key: ${OPENAI_API_KEY}
    enabled: true
  anthropic:
    base_url: https://api.anthropic.com
    api_key: ${ANTHROPIC_API_KEY}
    enabled: true

auth:
  enabled: true
  keys:
    - ${INGATE_KEY_TEAM_A}
    - ${INGATE_KEY_TEAM_B}

rate_limit:
  enabled: true
  requests_per_minute: 120

fallback:
  enabled: true
  max_retries: 1
  fallback_map:
    openai: anthropic
    anthropic: openai

database:
  postgresql_url: ${DATABASE_URL}
  redis_url: ${REDIS_URL}

retention:
  enabled: true
  log_retention_days: 30
  eval_result_retention_days: 90

scheduler:
  enabled: true
  interval_secs: 300
  batch_size: 100

Containers

In Docker and Kubernetes, prefer environment variables, which take precedence over config files. See Deployment for examples.