Skip to main content

Environment Variable

Specify the same environment variables cross shell.

Syntaxโ€‹

env:
- name: ALIAE_CONFIG
value: /Users/Jan/configs/aliae.yaml

Variableโ€‹

NameTypeDescription
namestringthe variable name
valueanythe variable value, supports templating
delimiterstringif you want to join an array of string values (separated by newlines), supports templating
ifstringgolang template conditional statement, see if
persistbooleanif you want to persist the environment variable into the registry for the current user (Windows only)
typestringtype to export to, possible values are string (default) and array
isPathbooleanif true, normalize rendered path separators to the current OS style
ifExistsbooleanif true, export only when the rendered path exists as a directory (requires isPath: true)

Path-valued environment variablesโ€‹

Use isPath: true for environment variables that represent filesystem paths. This keeps PATH/CDPATH behavior scoped to their own config sections while giving other env vars explicit path normalization.

When isPath: true and value is multiline, aliae automatically behaves as if ifExists: true and picks the first existing directory. For single-line values, ifExists remains false unless you set it explicitly.

env:
- name: ANDROID_SDK_ROOT
value: '{{ .Home }}/AppData/Local/Android/Sdk'
isPath: true
ifExists: true
- name: ANDROID_HOME
value: |
{{ env "LOCALAPPDATA" }}/Android/Sdk
{{ .Home }}/Library/Android/sdk
{{ .Home }}/Android/Sdk
isPath: true
tip

If a single-line value starts with a Go template, quote the entire string.

Expected output by shellโ€‹

The examples below use:

env:
- name: HELLO
value: world
- name: ARRAY
value: hello array world
type: array
export HELLO="world"
export ARRAY=("hello" "array" "world")