Working directory, environment, and secrets
Goal
Understand where your code runs and which environment variables it can see. Time: 10 minutes.
Working directory
Each code block starts in the run’s files/ directory:
Your project folder (the workflow’s folder setting) isn’t the working directory, and Termorq never changes it. Use $TERMORQ_FOLDER to read from it.
Variables Termorq sets
| Variable | Value |
|---|---|
TERMORQ_INPUT | Path to the input file (only set when the block has inputs) |
TERMORQ_OUTPUT | The run’s files/ directory |
TERMORQ_FOLDER | The workflow’s configured folder |
TERMORQ_WORKFLOW | The workflow ID |
TERMORQ_RUN | The run ID |
TERMORQ_BLOCK | The current block ID |
The env map
The root env: map adds variables to every code block. Values are templates, so you can pass a secret to trusted code this way:
Timeouts
timeout_secs (default 600) limits how long each block can run. You can change the default for new workflows under Settings → Workflows.
Check your run
The stderr log shows cwd=…/runs/env-demo/<run id>/files, and the output is region: "eu-west".
Exercise
Set timeout_secs: 2 and add sleep 5 to the block. What happens?