This commit is contained in:
vet
2026-04-14 11:05:46 +07:00
parent 2e0af83599
commit 6c30dddbbe
4 changed files with 86 additions and 15 deletions

View File

@@ -247,3 +247,34 @@ pc_export_vite_backend_env() {
export VITE_WS_URL="${PC_VITE_WS_URL:-wss://${host}/msg_gateway}"
fi
}
pc_print_vite_backend_env() {
if [[ -z "${PC_BACKEND_ORIGIN:-}" ]]; then
warn " pc 未设置 PC_BACKEND_ORIGIN将使用 pc/.env 或代码默认地址WebSocket 可能连错环境"
return 0
fi
info " pc 后端 PC_BACKEND_ORIGIN=${PC_BACKEND_ORIGIN}(注入 VITE_*,不写 pc 目录)"
info " VITE_API_URL=${VITE_API_URL:-<empty>}"
info " VITE_WS_URL=${VITE_WS_URL:-<empty>}"
info " VITE_CHAT_URL=${VITE_CHAT_URL:-<empty>}"
info " VITE_USER_URL=${VITE_USER_URL:-<empty>}"
}
pc_check_nginx_gateway() {
local o="${PC_BACKEND_ORIGIN:-}"
o="${o%/}"
[[ -z "$o" ]] && return 0
if ! command -v curl &>/dev/null; then
warn " 未安装 curl跳过 Nginx 网关检查;请手动访问 ${o}/nginx-health"
return 0
fi
if curl -fsS --max-time 3 "${o}/nginx-health" >/dev/null 2>&1; then
success " Nginx 网关可达: ${o}/nginx-health"
else
warn " Nginx 网关不可达: ${o}/nginx-health"
warn " PC WebSocket 默认连 ${VITE_WS_URL:-ws://<host>/msg_gateway};请确认已执行 sudo ./deploy-test/00-init-tools.sh nginx并放行 TCP 80"
fi
}