#!/usr/bin/env bash set -euo pipefail # Ubuntu/systemd 前端启动入口。 # 运行生产构建后的 Next.js 服务;开发调试继续使用 scripts/start-webui.sh。 ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" ENV_FILE="${ROOT_DIR}/.env.deploy" if [[ -f "${ENV_FILE}" ]]; then # shellcheck disable=SC1090 source "${ENV_FILE}" else echo "Missing deploy config: ${ENV_FILE}" >&2 echo "Run: bash scripts/deploy-ubuntu.sh" >&2 exit 1 fi BACKEND_HOST="${CLAW_BACKEND_HOST:-127.0.0.1}" BACKEND_PORT="${CLAW_BACKEND_PORT:-8765}" FRONTEND_HOST="${CLAW_FRONTEND_HOST:-0.0.0.0}" FRONTEND_PORT="${CLAW_FRONTEND_PORT:-3000}" export CLAW_API_URL="${CLAW_API_URL:-http://${BACKEND_HOST}:${BACKEND_PORT}}" cd "${ROOT_DIR}/frontend/app" exec npm run start -- --hostname "${FRONTEND_HOST}" --port "${FRONTEND_PORT}"