1
0
mirror of https://github.com/1Panel-dev/1Panel.git synced 2025-01-19 16:29:17 +08:00
1Panel/agent/init/router/router.go
2024-12-19 22:21:00 +08:00

31 lines
688 B
Go

package router
import (
v2 "github.com/1Panel-dev/1Panel/agent/app/api/v2"
"github.com/1Panel-dev/1Panel/agent/global"
"github.com/1Panel-dev/1Panel/agent/i18n"
"github.com/1Panel-dev/1Panel/agent/middleware"
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())
PrivateGroup := Router.Group("/api/v2")
if !global.IsMaster {
PrivateGroup.Use(middleware.Certificate())
}
for _, router := range rou.RouterGroupApp {
router.InitRouter(PrivateGroup)
}
PrivateGroup.GET("/health/check", v2.ApiGroupApp.BaseApi.CheckHealth)
return Router
}