Configure Station Variables
Last updated on November 23, 2026
Run one procedure on several benches, each with its own DMM address, and talk to a different MES per environment. The values live in TofuPilot, not in your repository.
| Key | Type | Set per |
|---|---|---|
DMM_RESOURCE | Config | Station |
MES_URL | Config | Environment |
MES_TOKEN | Secret | Environment |
Prerequisites
- A procedure linked to TofuPilot and deployed with git deployments
- Two stations running it, here
bench-1andbench-2 - The Admin or Owner role, and the CLI logged in as yourself (
tofupilot login)
Step 1: Declare the Keys
Declare the keys in procedure.yaml, then pass them to the plug and the phase with with:.
config:
DMM_RESOURCE:
required: true
MES_URL:
required: true
secrets:
MES_TOKEN:
required: true
plugs:
- name: DMM
python: plugs.dmm:Dmm
with:
resource: "{config.DMM_RESOURCE}"
main:
- name: Report to MES
python: phases.mes:report
with:
url: "{config.MES_URL}"
token: "{secrets.MES_TOKEN}"import requests
def report(unit, url, token):
# url and token are resolved for this run's environment
response = requests.post(
f"{url}/results",
headers={"Authorization": f"Bearer {token}"},
json={"serial": unit.serial_number},
timeout=10,
)
response.raise_for_status()Step 2: Run Locally
Local runs read .env.local next to procedure.yaml, never the values stored in TofuPilot.
DMM_RESOURCE="TCPIP0::192.168.1.50::INSTR"
MES_URL="https://mes-sandbox.example.com"
MES_TOKEN="sandbox-token"echo ".env*" >> .gitignore
tofupilot run .Step 3: Set the Values
Set the DMM address on each station as a Config:
tofupilot env add DMM_RESOURCE --station bench-1 --no-sensitive --value "TCPIP0::10.0.1.21::INSTR"
tofupilot env add DMM_RESOURCE --station bench-2 --no-sensitive --value "TCPIP0::10.0.1.22::INSTR"Set the MES URL per environment on the procedure:
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.comSet the token per environment. The CLI asks for each value at a hidden prompt:
tofupilot env add MES_TOKEN production --note "Rotate in the MES admin console"
tofupilot env add MES_TOKEN preview,developmentYou can also set them in the dashboard, on the station page and the procedure's Environment Variables tab.
Step 4: Check Each Station
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 -The station value wins over the procedure, which wins over Shared.
Step 5: Deploy and Run
Merge to your production branch. Each station pulls the build and fetches its values before the run.
A station missing a required value does not start the run. The operator sees the missing keys:
Station not configured: config.DMM_RESOURCE missingEach run records the values it used: the DMM address and MES URL, and the version of MES_TOKEN, never its value.
A preview build on a line station receives the preview token, and no secret set on the station. Production credentials only reach production builds. See Environment Variables Security.
Step 6: Rotate the Token
tofupilot env update MES_TOKEN productionOr use Rotate in the dashboard. The version increases, so you can tell which runs used which token.
How is this guide?
Offline Upload Queue
Learn how the TofuPilot CLI buffers runs locally when the dashboard is unreachable so no run is lost to a transient outage on the factory floor.
Studio
Edit a test procedure's sequence, run it and debug its plugs from a local page the TofuPilot CLI serves on your own machine, next to your files and instruments.