---
title: "Environment variables"
description: "Every environment variable Kiln reads, with accepted values, where it applies, and how it ranks against the config file."
---

> Documentation Index
> Fetch the complete documentation index at: https://kiln.wbxdocs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Environment variables

Kiln reads environment variables once at startup and never re-reads them. Unless noted otherwise, only a non-empty value has any effect; an empty value is the same as an unset one.

## Server variables

| Variable | Effect | Values | Precedence |
| --- | --- | --- | --- |
| `KILN_LISTEN` | Overrides `server.listen` | Host and port | Above the config file |
| `KILN_PUBLIC_BASE_URL` | Overrides `server.public_base_url` | Absolute URL; a trailing slash is trimmed | Above the config file |
| `KILN_DATA_DIR` | Overrides `server.data_dir` | Directory path | Above the config file |
| `KILN_TOKEN_PRIVATE_KEY` | Overrides `auth.token_private_key` | Ed25519 private key PEM | Above the config file |
| `KILN_TOKEN_PRIVATE_KEY_FILE` | Overrides `auth.token_private_key_file` | File path | Above the config file |
| `KILN_TOKEN_PUBLIC_KEY` | Overrides `auth.token_public_key` | Ed25519 public key PEM | Above the config file |
| `KILN_TOKEN_PUBLIC_KEY_FILE` | Overrides `auth.token_public_key_file` | File path | Above the config file |
| `KILN_RESOURCE_MODE` | Overrides `server.resource_mode` | `auto`, `performance`, `constrained` | Above the config file |
| `KILN_RESOURCE_MEMORY_MB` | Overrides detected memory | Positive integer, in MiB | Above autodetection |
| `KILN_RESOURCE_CPUS` | Overrides detected CPU capacity | Positive integer core count | Above autodetection |
| `KILN_RUNTIME_VARIANT` | Declares the runtime variant | `core`, `full`; unset means `standalone` | No config equivalent |
| `KILN_LOG_LEVEL` | Overrides `logging.level` | `debug`, `info`, `warn`, `error` | Above the config file |
| `KILN_LOG_FORMAT` | Overrides `logging.format` | `text`, `json` | Above the config file |
| `KILN_LOG_COLOR` | Overrides `logging.color` | `auto`, `always`, `never` | Above the config file |
| `KILN_DEFAULT_PACKAGER_ENGINE` | Supplies a fallback for `packager.engine` | `auto`, `native`, `ffmpeg` | Below the config file |
| `KILN_PLAY_OPEN` | Drives `security.play_require_auth` | `1`, `true`, `TRUE` disable auth; `0`, `false`, `FALSE` require it | The environment decides |
| `GOMEMLIMIT` | Go runtime soft memory limit | Any size the Go runtime accepts, such as `128MiB` | Always wins |
| `GOGC` | Go garbage-collection target percentage | Any value the Go runtime accepts, such as `100` or `off` | Prevents resource adaptation from setting the GC target |
| `NO_COLOR` | Disables log coloring | Any non-empty value | Only affects `auto` |

## Precedence rules

Most variables are applied after parsing and before defaults are filled in, so the usual order is **environment above config file above built-in default**. The following are exceptions to that order.

### KILN_DEFAULT_PACKAGER_ENGINE only applies when the config is silent

It is read while defaults are filled in, and only when `packager.engine` is empty. Any value in the config file wins outright. Once adopted it still goes through the normal validation, so a value outside `auto`, `native`, `ffmpeg` fails startup. The Lite variant sets the variable to `native` before loading the config if it is unset, and refuses any engine other than `native`.

### KILN_PLAY_OPEN overrides the playback auth setting

`1`, `true`, or `TRUE` sets `security.play_require_auth` to `false`; `0`, `false`, or `FALSE` sets it to `true`; any other value leaves the setting alone. With the variable unset the config file decides: `play_require_auth` is an optional boolean that defaults to requiring a credential, and an explicit `false` turns playback authentication off. Either way, disabling it belongs in debugging environments only.

### GOMEMLIMIT always beats the config and the automatic plan

Kiln sets a Go soft memory limit itself only when `server.memory_limit_mb` is positive **and** `GOMEMLIMIT` is unset. Whenever `GOMEMLIMIT` is present the runtime honors it, and neither the configured value nor the profile budget chosen by resource adaptation touches that setting.

### GOGC overrides the profile GC target

When `GOGC` is unset, Kiln adjusts the Go garbage-collection target for the active resource profile. When the variable is present, Kiln leaves it unchanged and the Go runtime interprets the value.

### KILN_RESOURCE_MEMORY_MB and KILN_RESOURCE_CPUS replace detection, not configuration

Neither variable overrides a config key. They replace the result of resource detection, which resource adaptation then uses to pick a profile. Only positive integers are accepted; unparsable, non-positive, or out-of-range values are ignored and detection stands. They are useful on hosts where detection is wrong, or to reproduce a specific profile. With `server.resource_mode = "performance"` adaptation is skipped entirely, so neither variable has any effect.

### NO_COLOR only matters in auto mode

Coloring looks at `logging.color` or `KILN_LOG_COLOR` first: `always` forces color and never consults `NO_COLOR`, `never` disables it, and `auto` (the default) colors only when the output is a terminal device and `NO_COLOR` is unset. JSON-formatted logs are never colored.

### KILN_RUNTIME_VARIANT is self-identification only

Unset means `standalone`. `core` and `full` are valid; anything else logs a warning at startup and is treated as `standalone`. The official container images already set it, so it rarely needs to be set by hand. See [Distribution variants](/en/guide/variants/) for a capability comparison.

## Install script variables

The install script reads a separate set of variables that only affect installation and upgrades, not the running server.

| Variable | Effect |
| --- | --- |
| `KILN_YES` | `1` skips every interactive confirmation |
| `KILN_VERSION` | Pins the version to install |
| `KILN_VARIANT` | Selects `full` or `lite`; anything else exits with an error |
| `KILN_INSTALL_DIR` | Sets the install directory |
| `KILN_MIRROR` | Sets the download mirror |
| `KILN_NO_MIRROR` | `1` disables mirrors |
| `KILN_LANG` | Forces the script output language |
| `KILN_DRY_RUN` | `1` walks through the flow without writing anything |

The install script honors `NO_COLOR` as well. See [Install script](/en/start/install-script/) for usage.

> **Development-only variables**
>
> The repository also carries variables that exist purely for the load-test tool, image smoke scripts, and the test suite. They have no effect on a production deployment and are out of scope here.

Source: https://kiln.wbxdocs.com/en/reference/env/index.mdx
