Environment Variables
Gateway
The gateway is configured only through these variables. An empty value is the same as leaving the variable out, and an invalid value stops the gateway at startup. Gateway configuration explains when to set each one.
| Variable | Default | Description |
|---|---|---|
GATEWAY_AGENT_PUBLIC_KEY | required | Agent public key from onprest-gateway create-agent-secret |
GATEWAY_API_KEYS_JSON | required | JSON array of API keys: name, bcrypt key_hash, capabilities |
GATEWAY_ADDR | :8080 | Listen address |
GATEWAY_PUBLIC_URL | derived from GATEWAY_ADDR | External base URL written into OpenAPI servers |
ONPREST_PUBLIC_BASE_URL | none | Origin for file download links. If any capability uses reference delivery and this is unset, no capability is published |
GATEWAY_CORS_ALLOWED_ORIGINS | none | Comma-separated browser origins allowed to call the gateway |
GATEWAY_IP_ALLOW_LIST | none | Comma-separated CIDRs or IPs allowed to reach any route |
GATEWAY_TRUSTED_PROXY_CIDRS | none | Proxies whose X-Forwarded-For / X-Real-IP headers are trusted |
GATEWAY_RATE_LIMIT_REQUESTS_PER_SECOND | 10 | Requests per second per source IP |
GATEWAY_RATE_LIMIT_BURST | 20 | Burst size per source IP |
GATEWAY_EMIT_OPENAPI_SNAPSHOT | false | Write the full OpenAPI document to stdout when it is loaded |
GATEWAY_MAX_REQUEST_BODY_BYTES | 1048576 | Largest JSON body, and largest total of JSON parts in a multipart upload |
GATEWAY_MAX_FILE_REQUEST_BODY_BYTES | 104857600 | Largest multipart upload |
GATEWAY_MAX_CONCURRENT_BODY_READERS | 16 | Requests whose input the gateway holds at the same time |
GATEWAY_AGENT_PUBLIC_KEY=TrMm87V3aET3MmGUzHf3_XKZRPEHe1bDM-POH1mrjr8
GATEWAY_API_KEYS_JSON='[{"name":"dev","key_hash":"$2a$10$INgs32pPDl8EQAOTcQ1NN.eZUpNkDtyTKXh2luqxE32vNBmaLpy7m","capabilities":["get_customer","update_customer"]}]'
GATEWAY_ADDR=127.0.0.1:8080Agent
The agent is configured by capability.yaml; see Agent configuration. One environment variable selects the file:
| Variable | Default | Description |
|---|---|---|
AGENT_CAPABILITY_FILE | capability.yaml next to the binary | Path to the configuration. --config takes precedence |
The author command code test always needs explicit --config and --capability and ignores this variable. PostgreSQL capabilities refuse to start when certain PG* variables are set; see PostgreSQL.