fix(health): 添加 /api/v1/health 端点并修正 mci-server 健康检查

- HealthController: 提供无鉴权健康检查接口,返回 {status: ok}
- AuthInterceptor/WebConfig: 放行 /api/v1/health
- docker-compose.yml: mci-server 健康检查地址改为 /msg-platform/api/v1/health

注意:mci-server Docker 镜像当前因 Maven Central 无法解析 spring-boot-maven-plugin:4.1.0 而无法重新构建,健康检查修复已入库,待网络恢复后重新构建即可生效。
This commit is contained in:
2026-07-07 16:13:44 +08:00
parent 24a70eb530
commit bccd32ea73
4 changed files with 23 additions and 3 deletions

View File

@@ -0,0 +1,18 @@
package com.sino.mci.admin.controller;
import com.sino.mci.shared.web.ApiResponse;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Map;
@RestController
@RequestMapping("/api/v1/health")
public class HealthController {
@GetMapping
public ApiResponse<Map<String, String>> health() {
return ApiResponse.ok(Map.of("status", "ok"));
}
}

View File

@@ -16,7 +16,8 @@ public class AuthInterceptor implements HandlerInterceptor {
String method = request.getMethod();
if (path.contains("/api/v1/account/login")
|| ("POST".equals(method) && isExactPath(path, "/api/v1/account/tenant"))
|| ("POST".equals(method) && isExactPath(path, "/api/v1/account/user"))) {
|| ("POST".equals(method) && isExactPath(path, "/api/v1/account/user"))
|| isExactPath(path, "/api/v1/health")) {
return true;
}

View File

@@ -19,6 +19,7 @@ public class WebConfig implements WebMvcConfigurer {
.excludePathPatterns(
"/msg-platform/api/v1/account/login", "/api/v1/account/login",
"/msg-platform/api/v1/account/tenant", "/api/v1/account/tenant",
"/msg-platform/api/v1/account/user", "/api/v1/account/user");
"/msg-platform/api/v1/account/user", "/api/v1/account/user",
"/msg-platform/api/v1/health", "/api/v1/health");
}
}