-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.go
33 lines (31 loc) · 963 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
33
package main
import (
"github.com/DeanThompson/ginpprof"
"github.com/gin-gonic/gin"
"github.com/open-kingfisher/king-kf/router"
"github.com/open-kingfisher/king-utils/common"
"github.com/open-kingfisher/king-utils/common/log"
"github.com/open-kingfisher/king-utils/common/rabbitmq"
"github.com/open-kingfisher/king-utils/config"
"github.com/open-kingfisher/king-utils/kit"
_ "github.com/open-kingfisher/king-utils/middleware/Validator"
)
func main() {
// Debug Mode
gin.SetMode(config.Mode)
g := gin.New()
// 设置路由
r := router.SetupRouter(kit.EnhanceGin(g))
ginpprof.Wrap(r)
// 通过消息中间件获取更新kubeConfig文件消息
consumer := rabbitmq.Consumer{
Address: config.RabbitMQURL,
ExchangeName: common.UpdateKubeConfig,
Handler: &rabbitmq.UpdateKubeConfig{},
}
go consumer.Run()
// Listen and Server in 0.0.0.0:8080
if err := r.Run(config.Listen); err != nil {
log.Fatalf("Listen error: %v", err)
}
}