This commit is contained in:
Yvan
2026-09-04 14:07:09 +08:00
parent af1e194396
commit 43db5e5450
22 changed files with 416 additions and 134 deletions
+7 -7
View File
@@ -36,7 +36,11 @@ func NewGinEngineWithRuntime(runtime *config.Store, access *systemservice.Access
prefix = strings.TrimSuffix(snapshot.Admin.RouterPrefix, "/")
}
public := engine.Group(prefix)
public.GET("/health", func(c *gin.Context) { c.JSON(http.StatusOK, "ok") })
health := func(c *gin.Context) { c.JSON(http.StatusOK, "ok") }
engine.GET("/health", health)
if prefix != "" {
public.GET("/health", health)
}
private := engine.Group(prefix)
// The reference administration behavior installs operation recording after JWT,
@@ -103,11 +107,11 @@ func NewGinEngineWithRuntime(runtime *config.Store, access *systemservice.Access
}
}
if ws != nil && ws.Enabled() {
engine.GET(ws.Path(), handleWebSocket)
engine.GET(websocketRoutePath(prefix, ws), handleWebSocket)
}
if logger != nil {
logger.Info("websocket endpoint initialized", "mod", "websocket",
"enabled", ws != nil && ws.Enabled(), "path", websocketPath(ws))
"enabled", ws != nil && ws.Enabled(), "path", websocketRoutePath(prefix, ws))
}
env := ""
if snapshot != nil && snapshot.Admin != nil && snapshot.Admin.App != nil {
@@ -125,10 +129,6 @@ func NewGinEngineWithRuntime(runtime *config.Store, access *systemservice.Access
}
engine.NoRoute(func(c *gin.Context) {
if ws != nil && ws.Enabled() && c.Request.Method == http.MethodGet && c.Request.URL.Path == websocketRoutePath(prefix, ws) {
handleWebSocket(c)
return
}
if staticfiles.Serve(c, runtime) {
return
}