Environment Variables¶
Demonator can export environment variables into every shell it spawns —
commands, setup/teardown hooks, wait_for runs, and interact runs all
see them.
Global env¶
Set env at the top level. Every step inherits these values:
env:
AWS_PROFILE: demo
LOG_LEVEL: debug
API_BASE_URL: http://localhost:8080
steps:
- text: "aws s3 ls" # AWS_PROFILE=demo
- text: "curl $API_BASE_URL/health"
Per-step env¶
Add env: to a single command step to override or extend the global map. The
merge is per-key: keys you define on the step win; keys you do not redefine
are still inherited from global:
env:
LOG_LEVEL: debug
steps:
- text: "./run --verbose" # LOG_LEVEL=debug
- text: "./run --quiet"
env:
LOG_LEVEL: error # this step only
- text: "./run --verbose again" # back to LOG_LEVEL=debug
Values are not interpolated¶
Demonator passes env values to the spawned shell verbatim. Writing
TOKEN: ${HOST_TOKEN} in YAML does not read HOST_TOKEN from the
process running demonator — it sets TOKEN to the literal string
${HOST_TOKEN}.
To pull a value from the host environment, reference it in the command itself (the shell expands it):
Anything you export from the shell that runs demonator is also inherited
by the spawned commands by default — env: only adds to (or overrides) that
inherited environment.