-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
38 lines (36 loc) · 726 Bytes
/
main.go
File metadata and controls
38 lines (36 loc) · 726 Bytes
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
package main
import (
"GoBlog/core"
_ "GoBlog/docs"
"GoBlog/flag"
"GoBlog/global"
"GoBlog/routers"
)
// @title GoBlog_server API文档
// @version 1.0
// @description API文档
// @host 127.0.0.1:9090
// @BasePath /
func main() {
// 读取配置文件
core.InitConf()
//初始化日志
global.Log = core.InitLogger()
// gorm的连接
global.DB = core.InitGorm()
//redis
global.Redis = core.InitRedis()
//命令行参数绑定
option := flag.Parse()
if flag.IsWebStop(option) {
flag.SwitchOption(option)
return
}
//初始化routers
r := routers.InitRouter()
global.Log.Info(global.Config.System.Addr())
err := r.Run(global.Config.System.Addr())
if err != nil {
global.Log.Fatalf(err.Error())
}
}