Files
operating-room-monitor-server/clients/demo-client/start.sh
Kevin 1af442481e 重组为 backend/clients/docs 三层结构,并清理 git 污染。
将后端迁入 backend/,完善根目录 .gitignore,删除误提交的 .mypy_cache 缓存文件。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-21 16:02:25 +08:00

37 lines
890 B
Bash
Executable File

#!/usr/bin/env bash
# Start the standalone demo client page for LAN access.
# Backend must be running first: cd backend && docker compose up -d --build
# Usage: ./start.sh [port]
set -euo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$ROOT"
PORT="${1:-${DEMO_PORT:-38081}}"
HOST="${DEMO_HOST:-0.0.0.0}"
API_PORT="${API_PORT:-38080}"
LAN_IP="$(python3 - <<'PY'
import socket
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
try:
s.connect(("8.8.8.8", 80))
print(s.getsockname()[0])
except OSError:
print("")
finally:
s.close()
PY
)"
echo "Demo client listening on ${HOST}:${PORT}"
echo "Local: http://127.0.0.1:${PORT}/"
if [[ -n "${LAN_IP}" && ( "${HOST}" == "0.0.0.0" || "${HOST}" == "::" ) ]]; then
echo "LAN: http://${LAN_IP}:${PORT}/"
echo "Base URL: http://${LAN_IP}:${API_PORT}"
fi
exec python3 server.py --host "$HOST" -p "$PORT"