1
0
mirror of https://github.com/1Panel-dev/1Panel.git synced 2025-01-20 16:59:17 +08:00
1Panel/agent/init/router/router.go

31 lines
688 B
Go
Raw Normal View History

2024-07-23 14:48:37 +08:00
package router
import (
v2 "github.com/1Panel-dev/1Panel/agent/app/api/v2"
"github.com/1Panel-dev/1Panel/agent/global"
2024-07-23 14:48:37 +08:00
"github.com/1Panel-dev/1Panel/agent/i18n"
2024-07-31 18:29:41 +08:00
"github.com/1Panel-dev/1Panel/agent/middleware"
2024-07-23 14:48:37 +08:00
rou "github.com/1Panel-dev/1Panel/agent/router"
"github.com/gin-gonic/gin"
)
var (
Router *gin.Engine
)
func Routers() *gin.Engine {
Router = gin.Default()
Router.Use(i18n.UseI18n())
2024-07-25 14:43:41 +08:00
PrivateGroup := Router.Group("/api/v2")
if !global.IsMaster {
PrivateGroup.Use(middleware.Certificate())
}
2024-07-23 14:48:37 +08:00
for _, router := range rou.RouterGroupApp {
router.InitRouter(PrivateGroup)
}
PrivateGroup.GET("/health/check", v2.ApiGroupApp.BaseApi.CheckHealth)
2024-07-23 14:48:37 +08:00
return Router
}