iop/bin/web.sh

24 lines
864 B
Bash
Executable file

#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
PORTAL_DIR="$REPO_ROOT/apps/portal"
WEB_HOST="${IOP_WEB_HOST:-0.0.0.0}"
WEB_PORT="${IOP_WEB_PORT:-3000}"
IOP_CONTROL_PLANE_HTTP_URL="${IOP_CONTROL_PLANE_HTTP_URL:-http://localhost:9080}"
IOP_CONTROL_PLANE_WIRE_URL="${IOP_CONTROL_PLANE_WIRE_URL:-ws://localhost:19080/portal}"
cd "$PORTAL_DIR"
echo "[web] dir=$PORTAL_DIR"
echo "[web] listen=$WEB_HOST:$WEB_PORT"
echo "[web] control_plane_http=$IOP_CONTROL_PLANE_HTTP_URL"
echo "[web] control_plane_wire=$IOP_CONTROL_PLANE_WIRE_URL"
exec flutter run -d web-server \
--web-hostname "$WEB_HOST" \
--web-port "$WEB_PORT" \
--dart-define=IOP_CONTROL_PLANE_HTTP_URL="$IOP_CONTROL_PLANE_HTTP_URL" \
--dart-define=IOP_CONTROL_PLANE_WIRE_URL="$IOP_CONTROL_PLANE_WIRE_URL"