#!/usr/bin/env bash # The demo server: one command, bound to the network so a phone can reach it. # # ./run-demo-server.sh # both demo shelves enrolled (stock-demo) # ./run-demo-server.sh stock-milk150 # # The iPhone must be on the same Wi-Fi as this Mac, and the app must point at this # Mac's address - Config.xcconfig's APP_RECOGNITION_BASE_URL, which the app reads at # build time. The script prints the exact line to use. set -euo pipefail cd "$(dirname "$0")" STOCK="${1:-stock-demo}" PORT="${PORT:-8099}" if [ ! -d "$STOCK" ]; then echo "no such store: $STOCK" >&2 exit 1 fi IP="$(ipconfig getifaddr en0 2>/dev/null || ipconfig getifaddr en1 2>/dev/null || true)" if [ -z "$IP" ]; then echo "this Mac has no LAN address; the phone cannot reach it" >&2 exit 1 fi cat <