Skip to Content
ReferenceEnvironment Variables

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.

VariableDefaultDescription
GATEWAY_AGENT_PUBLIC_KEYrequiredAgent public key from onprest-gateway create-agent-secret
GATEWAY_API_KEYS_JSONrequiredJSON array of API keys: name, bcrypt key_hash, capabilities
GATEWAY_ADDR:8080Listen address
GATEWAY_PUBLIC_URLderived from GATEWAY_ADDRExternal base URL written into OpenAPI servers
ONPREST_PUBLIC_BASE_URLnoneOrigin for file download links. If any capability uses reference delivery and this is unset, no capability is published
GATEWAY_CORS_ALLOWED_ORIGINSnoneComma-separated browser origins allowed to call the gateway
GATEWAY_IP_ALLOW_LISTnoneComma-separated CIDRs or IPs allowed to reach any route
GATEWAY_TRUSTED_PROXY_CIDRSnoneProxies whose X-Forwarded-For / X-Real-IP headers are trusted
GATEWAY_RATE_LIMIT_REQUESTS_PER_SECOND10Requests per second per source IP
GATEWAY_RATE_LIMIT_BURST20Burst size per source IP
GATEWAY_EMIT_OPENAPI_SNAPSHOTfalseWrite the full OpenAPI document to stdout when it is loaded
GATEWAY_MAX_REQUEST_BODY_BYTES1048576Largest JSON body, and largest total of JSON parts in a multipart upload
GATEWAY_MAX_FILE_REQUEST_BODY_BYTES104857600Largest multipart upload
GATEWAY_MAX_CONCURRENT_BODY_READERS16Requests 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:8080

Agent

The agent is configured by capability.yaml; see Agent configuration. One environment variable selects the file:

VariableDefaultDescription
AGENT_CAPABILITY_FILEcapability.yaml next to the binaryPath 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.