#!/bin/sh # Copy examples//flow.json into the running Node-RED project's # flow.json. Use this after regenerating flow.json from build_flow.py # when you want the runtime to reload the canonical source. # # Usage: # scripts/sync-example.sh # # Example: # scripts/sync-example.sh pumpingstation-complete-example set -e NAME="${1:-pumpingstation-complete-example}" SRC="examples/$NAME/flow.json" CONTAINER="evolv-nodered" DST="/data/projects/$NAME/flow.json" if [ ! -f "$SRC" ]; then echo "error: $SRC not found (run from EVOLV repo root)" >&2 exit 1 fi if ! docker ps --format '{{.Names}}' | grep -q "^$CONTAINER$"; then echo "error: $CONTAINER is not running" >&2 exit 1 fi echo "Copying $SRC → $CONTAINER:$DST" docker cp "$SRC" "$CONTAINER:$DST" echo "Reloading flows..." curl -s -X POST "http://localhost:1880/flows" \ -H "Content-Type: application/json" \ -H "Node-RED-Deployment-Type: full" \ --data-binary "@$SRC" \ -w 'HTTP %{http_code}\n'