docs/configuration/vars.md
[vars] defines values that can be reused in mise configuration templates. Vars are similar to
environment variables, but mise does not export them to child processes. Reference a var in a
Tera template with <span v-pre>{{ vars.NAME }}</span>.
[vars]
node_version = "24"
test_mode = "headless"
[tools]
node = "{{ vars.node_version }}"
[tasks.test]
run = "echo {{ vars.test_mode | quote }}"
Run mise run test to print headless. test_mode is available through the
vars template map, but it is not exported as $test_mode. The quote filter in
this example targets POSIX shells; see template quoting.
Vars are available to Tera-rendered configuration such as tool versions and options, task definitions, hooks, task includes, watch configuration, and dotfile templates. See Templates for the complete template syntax and context.
Vars support the same value-producing directives as [env], including defaults,
required values, redaction, files, sources, and secrets.
[vars]
test_mode = { default = "headless" }
api_token = { required = "Set api_token in mise.local.toml" }
secret_arg = { value = "--token=abc123", redact = true }
_.file = ".env"
The default form uses a process environment variable with the same name when it is set and
non-empty; values from [env] are not used for this lookup. A required var must be supplied by the
process environment or a later config file. Values marked redact = true are hidden from task
output.
See the env._ directive reference for the available file, source,
and plugin-provided directive forms. When used under [vars], these directives populate vars
instead of exporting the values as environment variables.
Vars follow mise's configuration hierarchy. They can be defined in the global config and overridden by project or environment-specific config files.
For example, a default can be defined globally:
[vars]
test_mode = "headless"
Then overridden for a project:
[vars]
test_mode = "headed"
TOML tasks can define their own vars. Task-local values override config vars while that task is rendered, but do not change the vars available elsewhere in the configuration.
[vars]
test_mode = "headless"
[tasks.test]
vars = { test_mode = "headed" }
run = "echo {{ vars.test_mode | quote }}"
Here, mise run test prints headed; other tasks still see headless unless
they define their own override. See Task Configuration
for task-local vars.