File size: 696 Bytes
63dd587
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/env bash
set -euo pipefail

# Reliable server launcher for environments without system python/uvicorn.
HOST="${HOST:-0.0.0.0}"
PORT="${PORT:-7866}"
RELOAD="${RELOAD:-false}"
ENABLE_WEB_INTERFACE="${ENABLE_WEB_INTERFACE:-false}"

CMD=(
  uv run --no-project
  --with fastapi
  --with uvicorn
  --with pydantic
  --with numpy
  python -m uvicorn server.app:app
  --host "${HOST}"
  --port "${PORT}"
)

if [[ "${RELOAD}" == "true" ]]; then
  CMD+=(--reload)
fi

# Pass through extra CLI args to uvicorn.
CMD+=("$@")

echo "Starting structural-design-env server on ${HOST}:${PORT} (reload=${RELOAD}, web=${ENABLE_WEB_INTERFACE})"
ENABLE_WEB_INTERFACE="${ENABLE_WEB_INTERFACE}" "${CMD[@]}"