[REQ-通用-006] 预生产测试通道:三端测试登录入口 + 文档链 + 部署脚本
- 三端 Login.vue(坐席/管理/H5)新增「测试账号登录」面板:探测 /api/dev/health 决定可见性,公网 403 自动隐藏,免企微扫码登录(token 写入对应 localStorage 键) - 新增 REQ-通用-006 文档链五件套:PRD / 技术方案 / 任务说明书 / 测试用例 / 部署方案(product-doc-standard 规范) - 版本迭代总览追加 v5.1(预生产测试通道)行 - 部署辅助脚本:nginx /api/dev/ 内网闸门注入、H5 版本化 v20260808→v20260811 升级 部署已落地预生产(10.90.5.110):公网 /api/dev/* 403、内网 200、三端登录页新 hash 在线。
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""REQ-通用-006 预生产测试通道 — nginx /api/dev/ 内网闸门注入脚本(幂等)"""
|
||||
import shutil
|
||||
import sys
|
||||
|
||||
NGINX_CONF = "/opt/wecom-it-desk/nginx/nginx.conf"
|
||||
BAK = "/opt/wecom-it-desk/nginx/nginx.conf.bak-testch-20260811"
|
||||
|
||||
GATE_BLOCK = """ # ============================================================
|
||||
# 预生产测试通道 (REQ-通用-006) - nginx 内网闸门
|
||||
# 仅内网可访问 /api/dev/*,公网 403。部署后须双向 curl 验证
|
||||
# ============================================================
|
||||
location /api/dev/ {
|
||||
allow 10.0.0.0/8;
|
||||
allow 172.16.0.0/12;
|
||||
allow 192.168.0.0/16;
|
||||
deny all;
|
||||
proxy_pass http://backend_api/;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
|
||||
"""
|
||||
|
||||
|
||||
def main() -> int:
|
||||
with open(NGINX_CONF, encoding="utf-8") as f:
|
||||
src = f.read()
|
||||
|
||||
if "location /api/dev/" in src:
|
||||
print("ALREADY_EXISTS")
|
||||
return 0
|
||||
|
||||
anchor = "location /api/ {\n"
|
||||
idx = src.find(anchor)
|
||||
if idx < 0:
|
||||
print("ANCHOR_NOT_FOUND")
|
||||
return 1
|
||||
|
||||
shutil.copy2(NGINX_CONF, BAK)
|
||||
new_src = src[:idx] + GATE_BLOCK + src[idx:]
|
||||
with open(NGINX_CONF, "w", encoding="utf-8") as f:
|
||||
f.write(new_src)
|
||||
print("INSERTED_OK")
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
Reference in New Issue
Block a user