-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.go
49 lines (40 loc) · 852 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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package main
import (
"log"
"ConfigPlatform/conf"
"ConfigPlatform/conf/mysql"
"ConfigPlatform/conf/redis"
_ "ConfigPlatform/docs"
"ConfigPlatform/routes"
"github.com/volatiletech/sqlboiler/v4/boil"
)
// @title 配置平台
// @contact.name 李明
// @contact.email [email protected]
// @version 1.0
// @description 配置管理平台 HTTP接口文档
func main() {
defer func() {
if err := recover(); err != nil {
log.Print(nil, "got_a_panic: ", err)
}
}()
// 加载配置文件
if err := conf.LoadConf(); err != nil {
return
}
// 初始化db
if err := mysql.InitDb(); err != nil {
return
}
defer mysql.Conn.Close()
// 初始化redis
if err := redis.InitRedis(); err != nil {
return
}
defer redis.RedisConn.Close()
// MySQL 设置Debug模式
boil.DebugMode = true
// 初始化路由
routes.InitRouter()
}