-
Notifications
You must be signed in to change notification settings - Fork 220
/
main.go
55 lines (44 loc) · 1.04 KB
/
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package main
import (
"decept-defense/controllers/topology_handler"
"decept-defense/internal/cluster"
"decept-defense/internal/cron"
"decept-defense/internal/env"
"decept-defense/models"
"decept-defense/pkg/configs"
"decept-defense/pkg/logger"
"decept-defense/router"
"github.com/gin-gonic/gin"
"github.com/spf13/pflag"
"go.uber.org/zap"
"net/http"
"strconv"
)
func SetUp() {
logger.SetUp()
models.SetUp()
env.Setup()
cluster.Setup()
cron.SetUp()
topology_handler.Setup()
}
// @title 欺骗防御接口文档
// @version 2.0
// @description
// @license.name MIT
// @license.url
// @host 127.0.0.1:8082
// @BasePath
func main() {
configs.SetUp()
serverIp := pflag.String("ip", "", "set server ip")
pflag.Parse()
if serverIp != nil && *serverIp != "" {
configs.UpdateIPConfig(*serverIp)
}
gin.SetMode(configs.GetSetting().Server.RunMode)
SetUp()
route := router.MakeRoute()
server := &http.Server{Addr: ":" + strconv.Itoa(configs.GetSetting().Server.HttpPort), Handler: route}
zap.L().Fatal(server.ListenAndServe().Error())
}