test
This commit is contained in:
27
common.sh
27
common.sh
@@ -226,9 +226,32 @@ print_svc_status() {
|
||||
# ── 所有后端服务名列表 ──────────────────────────────────────────────────────────
|
||||
ALL_SVCS=(openim-server chat-rpc admin-rpc chat-api admin-api meetingmsg livecloud livestream build-server)
|
||||
|
||||
# ── PC 反代入口环境归一化 ───────────────────────────────────────────────────────
|
||||
normalize_pc_proxy_env() {
|
||||
PC_PROXY_DOMAIN="${PC_PROXY_DOMAIN:-cms-jack.imharry.work}"
|
||||
local default_origin="https://${PC_PROXY_DOMAIN}"
|
||||
local origin="${PC_BACKEND_ORIGIN:-}"
|
||||
origin="${origin%/}"
|
||||
|
||||
if [[ -z "$origin" ]]; then
|
||||
PC_BACKEND_ORIGIN="$default_origin"
|
||||
elif [[ -n "${DEPLOY_TEST_IP:-}" ]] && [[ "$origin" =~ ^https?://${DEPLOY_TEST_IP}(:[0-9]+)?$ ]]; then
|
||||
warn " 检测到旧 PC_BACKEND_ORIGIN=${origin},已切换为 ${default_origin}"
|
||||
PC_BACKEND_ORIGIN="$default_origin"
|
||||
elif [[ "$origin" == "http://${PC_PROXY_DOMAIN}" ]]; then
|
||||
warn " 检测到 HTTP PC_BACKEND_ORIGIN=${origin},已切换为 ${default_origin}"
|
||||
PC_BACKEND_ORIGIN="$default_origin"
|
||||
else
|
||||
PC_BACKEND_ORIGIN="$origin"
|
||||
fi
|
||||
|
||||
export PC_PROXY_DOMAIN PC_BACKEND_ORIGIN
|
||||
}
|
||||
|
||||
# ── PC 前端 Vite 环境(不写 pc 目录,由 07-start-frontend 在子 shell 内 export)────────
|
||||
# 依赖 .env.deploy-test / .env.deploy-local 中的 PC_BACKEND_ORIGIN(及可选 PC_VITE_*)
|
||||
pc_export_vite_backend_env() {
|
||||
normalize_pc_proxy_env
|
||||
local o="${PC_BACKEND_ORIGIN:-}"
|
||||
o="${o%/}"
|
||||
[[ -z "$o" ]] && return 0
|
||||
@@ -262,7 +285,7 @@ pc_print_vite_backend_env() {
|
||||
info " VITE_ADMIN_URL=${VITE_ADMIN_URL:-${PC_VITE_ADMIN_URL:-<empty>}}"
|
||||
|
||||
if [[ "$PC_BACKEND_ORIGIN" == http://* ]] && [[ "$PC_BACKEND_ORIGIN" != http://127.0.0.1* ]] && [[ "$PC_BACKEND_ORIGIN" != http://localhost* ]]; then
|
||||
info " PC 使用 HTTP 公网入口: ${PC_BACKEND_ORIGIN}"
|
||||
warn " PC_BACKEND_ORIGIN 当前是 HTTP: ${PC_BACKEND_ORIGIN};推荐使用 https://${VITE_BASE_DOMAIN}"
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -283,7 +306,7 @@ pc_check_nginx_gateway() {
|
||||
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"
|
||||
warn " PC WebSocket 默认连 ${VITE_WS_URL:-wss://<host>/msg_gateway};请确认已执行 sudo ./deploy-test/00-init-tools.sh nginx,本机 Nginx 放行 TCP 80,外层 HTTPS 入口放行 TCP 443"
|
||||
fi
|
||||
|
||||
pc_probe_msg_gateway "$o"
|
||||
|
||||
Reference in New Issue
Block a user