fix: 将 get_weather_details 和 health_check 移出 JWT 保护作用域作为公开接口

This commit is contained in:
2026-04-18 14:04:49 +08:00
parent d756694534
commit fd21e641a2
4 changed files with 161 additions and 4 deletions

View File

@@ -69,6 +69,13 @@ upload_config() {
log_info "配置文件上传成功。"
}
upload_test_script() {
log_info "正在上传测试脚本到 ${REMOTE_USER}@${REMOTE_HOST}:${REMOTE_DIR}/..."
rsync -avzP --progress ./test_deployment.sh "${REMOTE_USER}@${REMOTE_HOST}:${REMOTE_DIR}/"
ssh "${REMOTE_USER}@${REMOTE_HOST}" "chmod +x ${REMOTE_DIR}/test_deployment.sh"
log_info "测试脚本上传成功。"
}
restart_remote_service() {
log_info "正在重启远程服务 '${SERVICE_NAME}'..."
if ssh "${REMOTE_USER}@${REMOTE_HOST}" "systemctl restart ${SERVICE_NAME}"; then
@@ -78,6 +85,15 @@ restart_remote_service() {
fi
}
run_deployment_tests() {
log_info "正在执行部署后测试..."
if ssh "${REMOTE_USER}@${REMOTE_HOST}" "cd ${REMOTE_DIR} && ./test_deployment.sh"; then
log_info "部署后测试通过。"
else
log_error "部署后测试失败!请检查服务状态。"
fi
}
main() {
log_info "========== 开始部署 (环境: ${APP_ENV}) =========="
log_info "远程目录: ${REMOTE_DIR}"
@@ -86,7 +102,9 @@ main() {
build_project
upload_binary
upload_config
upload_test_script
restart_remote_service
run_deployment_tests
log_info "========== 部署完成! =========="
}