-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
36 lines (33 loc) · 839 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
package main
import (
"fmt"
configs "role-system/configs"
"role-system/role/dao/role"
"role-system/role/dao/user"
"role-system/settings"
runCasbin "role-system/settings/casbin"
)
func main() {
// 配置初始化``
configs.InitConfig()
// 日志初始化
settings.InitLog()
// 数据库初始化
settings.InitMysqlServer()
// redis初始化
settings.InitRedis()
// casbin初始化
dapter := runCasbin.CasbinAdapter{
RoleRepo: role.Role{},
UserRoleRepo: user.UserRole{},
RoleObjectRepo: role.RoleObject{},
}
cabinConfig := runCasbin.CasbinConfig{
Model: settings.Conf.Casbin.Model,
}
settings.Casbin, _, _ = runCasbin.InitCasbin(&dapter, cabinConfig)
// gin项目启动
router := settings.InitRouter()
addr := fmt.Sprintf("%s:%d", configs.Conf.HTTP.Host, configs.Conf.HTTP.Port)
router.Run(addr)
}