feat: expose signed platform health status

This commit is contained in:
Codex Local
2026-08-26 21:15:03 +08:00
parent 1e12d329dc
commit 47ef596d3b
30 changed files with 811 additions and 26 deletions
+9
View File
@@ -48,6 +48,9 @@ type RouterOptions struct {
ProviderCallbackSecret []byte
ProviderCallbackSkew time.Duration
ProviderCallbackProcessor ProviderCallbackProcessor
PlatformHealthCallbackSecret []byte
PlatformHealthCallbackSkew time.Duration
PlatformHealthProcessor PlatformHealthProcessor
}
func NewRouter(options RouterOptions) http.Handler {
@@ -117,6 +120,7 @@ func NewRouter(options RouterOptions) http.Handler {
mux.Handle("GET /api/v1/ops/cost-summary", authenticated(GetOpsCostSummaryHandler(options.BillingService)))
}
if options.DiagnosticService != nil {
mux.Handle("GET /api/v1/ops/diagnostics/platform-health", authenticated(GetOpsPlatformHealthHandler(options.DiagnosticService)))
mux.Handle("GET /api/v1/ops/integration-issues", authenticated(ListOpsIntegrationIssuesHandler(options.DiagnosticService)))
mux.Handle("POST /api/v1/ops/integration-issues", authenticated(CreateOpsIntegrationIssueHandler(options.DiagnosticService)))
mux.Handle("PATCH /api/v1/ops/integration-issues/{id}", authenticated(UpdateOpsIntegrationIssueHandler(options.DiagnosticService)))
@@ -278,6 +282,11 @@ func NewRouter(options RouterOptions) http.Handler {
options.ProviderCallbackSecret, options.ProviderCallbackSkew, options.ProviderCallbackProcessor,
))
}
if options.ServiceName == "callbacks" && len(options.PlatformHealthCallbackSecret) > 0 && options.PlatformHealthProcessor != nil {
mux.Handle("POST /callbacks/v1/platform-health", PlatformHealthCallbackHandler(
options.PlatformHealthCallbackSecret, options.PlatformHealthCallbackSkew, options.PlatformHealthProcessor,
))
}
mux.HandleFunc("/", func(writer http.ResponseWriter, request *http.Request) {
WriteError(writer, request, http.StatusNotFound, "RESOURCE_NOT_FOUND", "请求的资源不存在")
})