-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
46 lines (39 loc) · 950 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
package main
import (
"github.com/yeongbok77/TaskManager/dao/es"
"github.com/yeongbok77/TaskManager/dao/mysql"
"github.com/yeongbok77/TaskManager/dao/redis"
"github.com/yeongbok77/TaskManager/logger"
"github.com/yeongbok77/TaskManager/router"
"github.com/yeongbok77/TaskManager/settings"
)
func main() {
// 配置文件初始化
if err := settings.Init(); err != nil {
panic("settings.Init err")
return
}
if err := logger.Init(settings.Conf.LogConfig, "dev"); err != nil {
panic("logger.Init err")
return
}
// MySQL初始化
if err := mysql.Init(settings.Conf.MySQLConfig); err != nil {
panic("mysql.Init err")
return
}
// Redis初始化
if err := redis.Init(settings.Conf.RedisConfig); err != nil {
panic("redis.Init err")
return
}
// ElasticSearch 初始化
if err := es.Init(); err != nil {
panic("es.Init err")
return
}
// 路由设置
r := router.SetUpRouter()
// 启动服务
r.Run(":8080")
}