Hive RouterConfiguration

Environment Variables

To configure Hive Router using environment variables, you use the pre-defined environment variables listed below, or hook any configuration field to an environment variable.

Pre-defined Environment Variables

The following environment variables are accepted by the router, and they override other configurations that can be set in the router's configuration file (router.config.yaml):

NameAccepted ValuesOverrides (YAML)
LOG_LEVELtrace / debug / info / warn / errorlog.level
LOG_FORMATjson / pretty-tree / pretty-compactlog.format
LOG_FILTERstringlog.filter
LABORATORY_ENABLEDtrue / falselaboratory.enabled
PORTnumber (port number)http.port
HOSTstring (host name or IP address)http.host
ROUTER_HTTP_WORKERSnumber (worker thread count)http.workers
SUPERGRAPH_FILE_PATHstring (relative or absolute path to a local file)supergraph[file].path
HIVE_CDN_ENDPOINTstring (full url to Hive CDN supergraph artifact)supergraph[hive].endpoint
HIVE_CDN_KEYstring (Hive CDN key)supergraph[hive].key
HIVE_CDN_POLL_INTERVALstring (human-readable, for example: 10s)supergraph[hive].poll_interval
APOLLO_GRAPH_REFstring (<GRAPH_ID>@<VARIANT>)supergraph[apollo_graphos].graph_ref
APOLLO_KEYstring (Apollo API key)supergraph[apollo_graphos].key
APOLLO_UPLINK_ENDPOINTSstring (comma-separated list of Uplink URLs)supergraph[apollo_graphos].endpoint
SUBSCRIPTIONS_ENABLEDtrue / falsesubscriptions.enabled
WEBSOCKET_ENABLEDtrue / falsewebsocket.enabled
TELEMETRY_TRACING_SAMPLING_RATEnumber (between 0.0 and 1.0)telemetry.tracing.collect.sampling
DISABLE_SUBGRAPH_ERROR_MASKINGtrue / falseerror_masking.enabled

In cases where a configuration file (router.config.yaml) is used with environment variables at the same time, environment variables will only override the specific configuration values.

In cases where the pre-defined environment variables are used, along with from_env, the pre-defined environment variable will be used as they are considered preferred over the configuration file values.

Setting Any Config Value from an Environment Variable

Beyond the fixed overrides above, any primitive field anywhere in the configuration file — strings, numbers, booleans — can be set from an environment variable using from_env, instead of a literal value:

router.config.yaml
http:
  port:
    from_env: PORT

If the referenced environment variable is not set, the field falls back to its own default (or fails validation as usual if the field is required). You can also supply an inline fallback with default, which is used instead of the field's own default when the environment variable is unset:

router.config.yaml
http:
  port:
    from_env: PORT
    default: 4000

If you are using the plugin system, from_env also works inside a plugin's own config block, since it's resolved before the configuration is split up and handed to each plugin.

Accessing Environment Variables in Expressions

Beyond using environment variables to override configuration values at startup, you can also access environment variables dynamically within expressions using the env() function.

For detailed documentation on the env() function and its parameters, see the expressions guide.

Additional Variables

In addition, you may specify the following environment variables:

NameAccepted ValuesDescription
ROUTER_CONFIG_FILE_PATHstring (relative or absolute path to a local file)Overrides the path to the router configuration file.