tofupilot env
Last updated on November 23, 2026
The env command manages the environment variables your procedures read. Without a level flag, it works on the procedure the current directory is linked to.
tofupilot env add MES_TOKEN production
tofupilot env lsIt requires a user login (tofupilot login). Every subcommand accepts --json.
Types
| Type | Flag | Use for |
|---|---|---|
| Secret | --type secret (default) | Passwords, API keys, tokens. Never shown again after saving |
| Config | --type config or --no-sensitive | Addresses, URLs, settings. Readable after saving |
Levels
| Flag | Applies to |
|---|---|
| none | The linked procedure |
--procedure <ID_OR_NAME> | That procedure |
--station <ID_OR_NAME> | Every procedure on that station |
--shared | Every procedure of the organization |
Environments
Pass environments as a comma-separated list of production, preview and development. Without one, a procedure or Shared value targets all three. Station values always count as production.
tofupilot env add MES_URL production --no-sensitive --value https://mes.example.com
tofupilot env add MES_URL preview,development --no-sensitive --value https://mes-sandbox.example.comadd
The add subcommand creates an environment variable. Without --value, it reads stdin, or asks at a prompt (hidden for a Secret).
# Secret, asked at a hidden prompt
tofupilot env add MES_TOKEN production
# Config on one station
tofupilot env add DMM_RESOURCE --station bench-2 --no-sensitive --value "TCPIP0::10.0.0.7::INSTR"
# From a script
printf %s "$TOKEN" | tofupilot env add MES_TOKEN --station bench-2| Flag | Effect |
|---|---|
--value <VALUE> | The value. A Secret passed here lands in your shell history: prefer the prompt or stdin |
--note <TEXT> | Where to rotate the value, or who to contact |
--value-type <TYPE> | string, number, integer or boolean, checked on save |
--force | Overwrite an existing variable with the same key |
-y, --yes | Skip confirmations |
A Config can be turned into a Secret with --type secret --force. A Secret cannot become a Config: remove it and add it again.
list
The list subcommand (alias ls) lists the environment variables of one level. Secrets show as a digest, which changes when the value changes.
tofupilot env ls
tofupilot env ls production --station bench-2
tofupilot env ls --shared --type secretupdate
The update subcommand sets a new value on an existing environment variable. Each update increases its version, so every run records which value it used.
tofupilot env update MES_TOKEN productionremove
The remove subcommand (alias rm) deletes an environment variable, after a confirmation.
tofupilot env rm MES_URL previewpull
The pull subcommand writes the linked procedure's development values into .env.local, where local runs read them.
tofupilot env pull
tofupilot env pull .env.bench --station bench-2The file is written with mode 0600. Secrets are included only when they target development. The command warns when .gitignore does not list the file.
run
The run subcommand runs a command with the linked procedure's development values, without writing a file.
tofupilot env run -- python scripts/check_mes.pyThe command behaves as if it ran alone and exits with its exit code. A Ctrl-C typed at the terminal reaches it directly; a SIGINT sent with no terminal or from the background (timeout -s INT, a supervisor, CI), SIGTERM and SIGHUP sent to tofupilot are passed on to it, and tofupilot waits for it to exit. A command that cannot be found exits 127, one that cannot be run 126, as in a shell.
resolve
The resolve subcommand shows, for each key, the value a station would receive and the level it comes from.
tofupilot env resolve production --station bench-2Key Value Wins Shadows
DMM_RESOURCE TCPIP0::10.0.1.22::INSTR station -
MES_URL https://mes.example.com procedure sharedPermissions
| Role | Can |
|---|---|
| Viewer and above | list and resolve |
| Developer | Change Config values that do not target production |
| Admin, Owner | Change everything, including Secrets and station values |
Since Secret and all environments are the defaults, a Developer adds Config values with --no-sensitive and an explicit preview or development.
How is this guide?