-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathmain.go
32 lines (28 loc) · 809 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package main
import (
"fmt"
"github.com/gin-gonic/gin"
"k8s.io/klog"
"kubernetes-admin-backend/config"
"kubernetes-admin-backend/middleware"
_ "kubernetes-admin-backend/proto"
"kubernetes-admin-backend/router"
)
func main() {
//go service.Informers() //todo informers监控
engine := gin.Default() //返回默认的路由引擎
gin.SetMode(gin.DebugMode)
engine.Use(middleware.Cors(), middleware.Monitor())
router.CollectRoute(engine)
err := engine.Run(fmt.Sprintf("%s:%d", config.GetString(config.ServerHost), config.GetInt(config.ServerPort)))
if err != nil {
klog.Fatal(err)
return
}
}
//engine.GET("/metrics", promHandler(promhttp.Handler()))
/*func promHandler(handler http.Handler) gin.HandlerFunc {
return func(c *gin.Context) {
handler.ServeHTTP(c.Writer, c.Request)
}
}*/