#!/usr/bin/env bash # Start the recognition server and write ignored local app endpoints. # # ./run-demo-server.sh # ./run-demo-server.sh stock-milk150 set -euo pipefail ROOT="$(cd "$(dirname "$0")/../.." && pwd)" cd "$(dirname "$0")" STOCK="${1:-stock-lopia-clean}" PORT="${PORT:-8099}" TOKEN_FILE=".demo-token" 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 if [ ! -s "$TOKEN_FILE" ]; then umask 077 openssl rand -hex 32 > "$TOKEN_FILE" fi TOKEN="$(tr -d '[:space:]' < "$TOKEN_FILE")" umask 077 cat > "$ROOT/iosApp/Configuration/Config.local.xcconfig" < config/local.env < "$TMP" mv "$TMP" "$PROPERTIES" cat <