forked from seccome/Ehoney
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
62 lines (55 loc) · 1.3 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
56
57
58
59
60
61
62
package main
import (
"decept-defense/controllers/topology_handler"
"decept-defense/internal/cluster"
"decept-defense/internal/cron"
"decept-defense/internal/harbor"
message "decept-defense/internal/message_client"
"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 module
logger.SetUp()
//db module
models.SetUp()
//message_client module
message.Setup()
//cluster module
cluster.Setup()
//harbor module
harbor.Setup()
//cron module
cron.SetUp()
//topology module
topology_handler.Setup()
}
// @title 欺骗防御接口文档
// @version 2.0
// @description
// @contact.name akita.tian
// @contact.url
// @contact.email [email protected]
// @license.name MIT
// @license.url
// @host 127.0.0.1:8082
// @BasePath
func main() {
//config module
configs.SetUp()
config := pflag.String("CONFIGS", "", "one click install parameter")
pflag.Parse()
configs.UpdateIPConfig(*config)
gin.SetMode(configs.GetSetting().Server.RunMode)
SetUp()
router := router.MakeRoute()
server := &http.Server{Addr: ":" + strconv.Itoa(configs.GetSetting().Server.HttpPort), Handler: router}
zap.L().Fatal(server.ListenAndServe().Error())
}