---
title: "Environment variables"
url: "/reference/configuration/environment-variables/"
kind: "reference"
summary: "The environment variables the arion binary reads: runtime sizing, log filtering and config-referenced secrets."
---

> Arion site index: [/llms.txt](/llms.txt)

# Environment variables

The environment variables the arion binary reads: runtime sizing, log filtering and config-referenced secrets.

Arion reads a small set of environment variables at startup; each overrides the matching `runtime` field and its command-line flag, so the precedence is environment, then flag, then file.

## Variables

| Variable | Value | Overrides | Description |
|---|---|---|---|
| `ARION_CPU_LIMIT` | integer ≥ 1 | `runtime.num_cpus` | Cores to use. Checked before `ARION_GATEWAY_CORES`. |
| `ARION_GATEWAY_CORES` | integer ≥ 1 | `runtime.num_cpus` | Cores to use, when `ARION_CPU_LIMIT` is unset. |
| `ARION_GATEWAY_RUNTIMES` | integer ≥ 1 | `runtime.num_runtimes` | Number of Tokio worker runtimes. |
| `ARION_SERVICE_THREADS` | integer ≥ 1 | `runtime.num_service_threads` | Threads for background service tasks. |
| `ARION_RT_GLOBAL_QUEUE_INTERVAL` | integer ≥ 1 | `runtime.global_queue_interval` | Scheduler ticks between global queue polls. |
| `ARION_RT_EVENT_INTERVAL` | integer | `runtime.event_interval` | Scheduler ticks between I/O event polls. |
| `ARION_RT_MAX_IO_EVENT_PER_TICK` | integer ≥ 1 | `runtime.max_io_events_per_tick` | Maximum I/O events processed per tick. |
| `ARION_CODEMODE_POOL_CAPACITY` | integer ≥ 1 | `runtime.codemode.pool_capacity` | Code-mode sandboxes the process can run at once. |
| `ARION_CODEMODE_MAX_MEMORY_BYTES` | integer ≥ 1 | `runtime.codemode.max_memory_bytes` | Largest memory one code-mode sandbox may use, in bytes. |
| `RUST_LOG` | filter string | `logging.log_level` | Process log filter, e.g. `info` or `arion_lib=debug,info`. |

```bash
ARION_CPU_LIMIT=4 ARION_GATEWAY_RUNTIMES=2 RUST_LOG=info arion -c arion.yaml
```

A value that does not parse (for example `ARION_CPU_LIMIT=abc` or `0`) is silently ignored and the next source in the precedence chain applies.

## Variables named in the configuration

Wherever an Envoy `DataSource` appears in the configuration — TLS certificates and keys, trusted CA bundles, inline bodies — the `environment_variable` variant makes Arion read that value from a variable you name:

```yaml,arion=fragment
private_key:
  environment_variable: ARION_TLS_KEY
```

The variable must be set when the config loads; a missing one fails with `failed to read environment variable`.

## Build-time variables

`CHANNEL_BODY_PREFETCH_FRAMES`, `EXT_PROC_BUFFERED_BODY_LIMIT`, `EXT_PROC_MERGE_WINDOW` and `EXT_PROC_FRAME_MERGE_LIMIT` tune ext_proc internals but are read when the binary is compiled, not at runtime. Setting them on a running deployment has no effect.
