Settings & dotenv
How to configure a Runefile and feed values to task bodies. Part of the guides; full syntax in the language guide.
Concept
Section titled “Concept”Variables (name := value) are reusable values resolved statically and interpolated with
{{ }}. Settings (set ...) configure the whole file. A project .env file is
loaded into task environments, so configuration and secrets come from the environment — never
hard-coded.
Syntax
Section titled “Syntax”out := "dist"# `/` joins paths (forward slash on every OS).bin := out / "app"
# Export Runefile variables into task environments.set export# Override the shell for (sh) bodies (rarely needed).set shell := ["bash", "-euo", "pipefail"]
build: @echo "building {{bin}}"A .env beside the Runefile is loaded automatically:
GREETING=helloRunnable example
Section titled “Runnable example”See examples/settings-dotenv — set export plus a
.env value reaching the body.
Pitfalls
Section titled “Pitfalls”- Secrets live in the environment, not the Runefile. Put them in
.env(kept out of version control) or the real environment. They never belong in a committed Runefile, and are never exposed to agents (see AI agents). As a safety net, values of sensitive-looking variables are masked as***in all output — see secret masking. set exportis opt-in. Without it, Runefile variables interpolate into commands but aren’t necessarily present as environment variables for sub-processes.- Paths use
/. The path-join operator emits forward slashes on every OS for portability. set shellruns the body as one script. Include-eso a failing line stops the task. The@and-prefixes have no effect. See shell override.
Next steps
Section titled “Next steps”- Parameters — per-invocation inputs (vs. file-level settings).
- Executors — how the environment reaches each body.