mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-04 15:06:37 +08:00
chore(cordis): sync Wavelet core/pkg/plugins after W1-W9
This commit is contained in:
@@ -56,9 +56,23 @@ func (p *Plugin) Apply(ctx *core.Context) error {
|
||||
ctx.Router().GET("/api/healthz", func(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, gin.H{"status": "ok"})
|
||||
})
|
||||
ctx.Router().GET("/api/health", func(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, response.OKNil())
|
||||
})
|
||||
ctx.Router().RegisterWhitelist("/api/health")
|
||||
|
||||
// 2. Public config
|
||||
ctx.Router().GET("/api/v1/config/public", func(c *gin.Context) {
|
||||
if p, err := core.Inject[contracts.PublicConfigProvider](ctx); err == nil && p != nil {
|
||||
data, err := p.PublicConfig(c.Request.Context())
|
||||
if err != nil {
|
||||
logger.ErrorF(c.Request.Context(), "[System] public config provider failed: %v", err)
|
||||
response.AbortInternal(c, "public config unavailable")
|
||||
return
|
||||
}
|
||||
c.JSON(http.StatusOK, response.OK(data))
|
||||
return
|
||||
}
|
||||
configs, err := listPublicSystemConfigs(c.Request.Context(), ctx)
|
||||
if err != nil {
|
||||
logger.ErrorF(c.Request.Context(), "[System] query public system configs failed: %v", err)
|
||||
|
||||
Reference in New Issue
Block a user