document configuring the node from the dataflow
validate / validate (push) Successful in 59m14s

Every setting is an environment variable, which reads fine for one and badly
for six: the README's table implied the only way to set them was to export them
around `dora run`. A node takes an `env:` map in the dataflow, applied to both
the build and the run, which keeps configuration with the wiring rather than in
whatever shell happened to start it. The README now shows a populated node.

A node's `env:` wins over the environment the dataflow was started in, and a
variable it does not set still passes through. That is why the block in
dataflow.yml is present but commented out: CI passes CAPTURE_FRAMES in through
the shell, and pinning it there would silently override the runner.
This commit is contained in:
2026-09-15 06:18:38 -03:00
parent 7628a8515b
commit 69ad074a79
2 changed files with 45 additions and 0 deletions
+35
View File
@@ -69,6 +69,41 @@ compressed encoding, `width` and `height` are the image's dimensions, not the le
|---|---| |---|---|
| `tick` | Publishes one frame. Wire to `dora/timer/millis/N`; the node stops when it closes. | | `tick` | Publishes one frame. Wire to `dora/timer/millis/N`; the node stops when it closes. |
## Configuring it
Every setting below is an environment variable, which is convenient for one and
awkward for several. A dataflow can carry them instead, per node, which keeps the
configuration with the wiring it belongs to and out of whatever shell happens to start
it:
```yaml
nodes:
- id: camera
git: ssh://git@gitea.liria.cl:5001/liria/dora-webcam.git
tag: v0.1.0
build: uv pip install .
path: dora-webcam
env:
CAMERA_ID: usb-Acme_Webcam
IMAGE_WIDTH: 1280
IMAGE_HEIGHT: 720
ENCODING: jpeg
JPEG_QUALITY: 85
FLIP: HORIZONTAL
inputs:
tick: dora/timer/millis/33
outputs:
- image
```
Values may be strings, numbers or booleans, and dora applies them to both the build and
the run.
**A node's `env:` wins over the environment the dataflow was started in.** A variable
the node does not set still passes through, so `PREVIEW=true dora run ...` works
alongside the block above — but a variable pinned there cannot be overridden from the
shell, which is worth remembering before pinning something a test needs to vary.
## Environment variables ## Environment variables
| Variable | Default | Meaning | | Variable | Default | Meaning |
+10
View File
@@ -7,6 +7,16 @@ nodes:
- id: camera - id: camera
path: dora-webcam path: dora-webcam
build: uv pip install . build: uv pip install .
# Settings belong here rather than in the environment of whatever starts the
# dataflow. Deliberately empty: a node's `env:` wins over the shell, and CI
# passes CAPTURE_FRAMES in through the shell, so pinning one here would
# silently override it. See the README for a populated example.
#
# env:
# CAMERA_ID: usb-Acme_Webcam
# IMAGE_WIDTH: 1280
# IMAGE_HEIGHT: 720
# ENCODING: jpeg
inputs: inputs:
tick: dora/timer/millis/33 tick: dora/timer/millis/33
outputs: outputs: