Skip to content

Commit 2247b7b

Browse files
feat: enhance health check endpoint to include GitHub client ID
1 parent defe273 commit 2247b7b

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

internal/api/handlers/v0/health.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,22 @@ package v0
44
import (
55
"encoding/json"
66
"net/http"
7+
8+
"github.com/modelcontextprotocol/registry/internal/config"
79
)
810

11+
type HealthResponse struct {
12+
Status string `json:"status"`
13+
GitHubClientId string `json:"github_client_id"`
14+
}
15+
916
// HealthHandler returns a handler for health check endpoint
10-
func HealthHandler() http.HandlerFunc {
17+
func HealthHandler(cfg *config.Config) http.HandlerFunc {
1118
return func(w http.ResponseWriter, r *http.Request) {
1219
w.Header().Set("Content-Type", "application/json")
13-
json.NewEncoder(w).Encode(map[string]string{"status": "ok"})
20+
json.NewEncoder(w).Encode(HealthResponse{
21+
Status: "ok",
22+
GitHubClientId: cfg.GithubClientID,
23+
})
1424
}
1525
}

internal/api/router/v0.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
// RegisterV0Routes registers all v0 API routes to the provided router
1414
func RegisterV0Routes(mux *http.ServeMux, cfg *config.Config, registry service.RegistryService, authService auth.Service) {
1515
// Register v0 endpoints
16-
mux.HandleFunc("/v0/health", v0.HealthHandler())
16+
mux.HandleFunc("/v0/health", v0.HealthHandler(cfg))
1717
mux.HandleFunc("/v0/servers", v0.ServersHandler(registry))
1818
mux.HandleFunc("/v0/servers/{id}", v0.ServersDetailHandler(registry))
1919
mux.HandleFunc("/v0/ping", v0.PingHandler(cfg))

0 commit comments

Comments
 (0)