OngoingAIOngoingAI Docs

Environment variable reference

Use this page to override gateway config values at process start. It documents supported variables, parse rules, and common failure cases.

How overrides work

  1. Gateway loads built-in defaults.
  2. Gateway applies ongoingai.yaml values when the file exists.
  3. Gateway applies supported ONGOINGAI_* env vars last.

Env vars override YAML only when the env value is non-empty. If you set a variable to an empty string, gateway ignores it.

Supported variables

VariableType and parse ruleOverridesExample
ONGOINGAI_HOSTstringserver.hostONGOINGAI_HOST=127.0.0.1
ONGOINGAI_PORTint (Atoi)server.portONGOINGAI_PORT=9090
ONGOINGAI_STORAGE_DRIVERstringstorage.driverONGOINGAI_STORAGE_DRIVER=postgres
ONGOINGAI_STORAGE_PATHstringstorage.pathONGOINGAI_STORAGE_PATH=./data/ongoingai.db
ONGOINGAI_STORAGE_DSNstringstorage.dsnONGOINGAI_STORAGE_DSN=postgres://user:pass@db:5432/ongoingai?sslmode=require
ONGOINGAI_OPENAI_UPSTREAMstringproviders.openai.upstreamONGOINGAI_OPENAI_UPSTREAM=https://api.openai.com
ONGOINGAI_ANTHROPIC_UPSTREAMstringproviders.anthropic.upstreamONGOINGAI_ANTHROPIC_UPSTREAM=https://api.anthropic.com
ONGOINGAI_CAPTURE_BODIESbool (ParseBool)tracing.capture_bodiesONGOINGAI_CAPTURE_BODIES=true
ONGOINGAI_BODY_MAX_SIZEint (Atoi)tracing.body_max_sizeONGOINGAI_BODY_MAX_SIZE=262144
OTEL_SDK_DISABLEDbool (ParseBool)observability.otel.enabled (inverse)OTEL_SDK_DISABLED=false
OTEL_EXPORTER_OTLP_ENDPOINTstringobservability.otel.endpointOTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318
OTEL_EXPORTER_OTLP_INSECUREbool (ParseBool)observability.otel.insecureOTEL_EXPORTER_OTLP_INSECURE=true
OTEL_SERVICE_NAMEstringobservability.otel.service_nameOTEL_SERVICE_NAME=ongoingai-gateway
OTEL_TRACES_EXPORTERenum (otlp/none)observability.otel.traces_enabledOTEL_TRACES_EXPORTER=otlp
OTEL_METRICS_EXPORTERenum (otlp/none)observability.otel.metrics_enabledOTEL_METRICS_EXPORTER=otlp
OTEL_TRACES_SAMPLER_ARGfloat (ParseFloat)observability.otel.sampling_ratioOTEL_TRACES_SAMPLER_ARG=0.25
OTEL_EXPORTER_OTLP_TIMEOUTint (Atoi)observability.otel.export_timeout_msOTEL_EXPORTER_OTLP_TIMEOUT=3000
OTEL_METRIC_EXPORT_INTERVALint (Atoi)observability.otel.metric_export_interval_msOTEL_METRIC_EXPORT_INTERVAL=10000
ONGOINGAI_PII_MODEstringpii.modeONGOINGAI_PII_MODE=redact_storage
ONGOINGAI_PII_POLICY_IDstringpii.policy_idONGOINGAI_PII_POLICY_ID=default/v1
ONGOINGAI_PII_HASH_SALTstringpii.replacement.hash_saltONGOINGAI_PII_HASH_SALT=workspace-salt
ONGOINGAI_AUTH_ENABLEDbool (ParseBool)auth.enabledONGOINGAI_AUTH_ENABLED=true
ONGOINGAI_AUTH_HEADERstringauth.headerONGOINGAI_AUTH_HEADER=X-Internal-Gateway-Key

OpenTelemetry auto-enable behavior:

  • If any OTEL exporter/service/sampler variable above is set, gateway enables OTEL by default.
  • OTEL_SDK_DISABLED=true always disables gateway OTEL instrumentation.

Values without env overrides

The following config areas do not support env var overrides in this release:

  • providers.*.prefix
  • pii.stages.*
  • pii.detectors.*
  • pii.headers.denylist
  • pii.body.key_denylist
  • pii.replacement.format
  • auth.keys
  • limits.*

Type and validation behavior

  • ONGOINGAI_PORT and ONGOINGAI_BODY_MAX_SIZE must parse as integers.
  • ONGOINGAI_CAPTURE_BODIES and ONGOINGAI_AUTH_ENABLED must parse as booleans.
  • OpenTelemetry bool fields (OTEL_SDK_DISABLED, OTEL_EXPORTER_OTLP_INSECURE) must parse as booleans.
  • OpenTelemetry integer fields (OTEL_EXPORTER_OTLP_TIMEOUT, OTEL_METRIC_EXPORT_INTERVAL) must parse as integers.
  • OpenTelemetry sampling field (OTEL_TRACES_SAMPLER_ARG) must parse as float.
  • OpenTelemetry exporter selectors (OTEL_TRACES_EXPORTER, OTEL_METRICS_EXPORTER) accept otlp or none.
  • String variables are applied as-is, then checked by config validation.
  • If a string override is invalid for the target field, ongoingai config validate fails with a field-specific error.

Examples:

  • ONGOINGAI_STORAGE_DRIVER=invalid fails with: storage.driver must be one of sqlite, postgres.
  • ONGOINGAI_OPENAI_UPSTREAM=api.openai.com fails with: providers.openai.upstream must include scheme and host.

Examples

Override server port for one command

Bash
ONGOINGAI_PORT=9090 ongoingai config validate --config ongoingai.yaml
ONGOINGAI_PORT=9090 ongoingai serve --config ongoingai.yaml

Enable Postgres without editing YAML

Bash
ONGOINGAI_STORAGE_DRIVER=postgres \
ONGOINGAI_STORAGE_DSN=POSTGRES_DSN \
ongoingai config validate --config ongoingai.yaml

Placeholder:

  • POSTGRES_DSN: Postgres DSN, for example postgres://user:pass@db.example.com:5432/ongoingai?sslmode=require.

Enable gateway auth with a custom header

Bash
ONGOINGAI_AUTH_ENABLED=true \
ONGOINGAI_AUTH_HEADER=X-Internal-Gateway-Key \
ongoingai serve --config ongoingai.yaml

Verification workflow

  1. Set one override and validate config:

    Bash
    ONGOINGAI_PORT=9090 ongoingai config validate --config ongoingai.yaml
  2. Start the gateway with the same override:

    Bash
    ONGOINGAI_PORT=9090 ongoingai serve --config ongoingai.yaml

You should see a startup log line with port set to 9090.

Troubleshooting

invalid ONGOINGAI_PORT

  • Symptom: ongoingai config validate fails before field validation.
  • Cause: ONGOINGAI_PORT is not an integer.
  • Fix: Set an integer value such as 8080 or 9090.

Invalid bool/float OTEL env values

  • Symptom: Config load fails with an invalid bool env var error.
  • Cause: A standard OTEL bool (OTEL_SDK_DISABLED, OTEL_EXPORTER_OTLP_INSECURE) or float (OTEL_TRACES_SAMPLER_ARG) env value does not parse.
  • Fix: Use valid bool values such as true/false and decimal floats such as 0.25.

Env var set but value does not change

  • Symptom: Gateway behavior still matches YAML.
  • Cause: Env var is empty, so override is skipped.
  • Fix: Set a non-empty env var value.

Expected env override is missing

  • Symptom: You cannot override a field with env vars.
  • Cause: That field does not have env mapping in this release.
  • Fix: Set the value in ongoingai.yaml instead.

Next steps