diff --git a/README.md b/README.md index e8c13ac..acda426 100644 --- a/README.md +++ b/README.md @@ -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. | +## 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 | Variable | Default | Meaning | diff --git a/dataflow.yml b/dataflow.yml index bd947cd..4be4fac 100644 --- a/dataflow.yml +++ b/dataflow.yml @@ -7,6 +7,16 @@ nodes: - id: camera path: dora-webcam 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: tick: dora/timer/millis/33 outputs: