-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
50 lines (45 loc) · 1.39 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
package main
import (
_ "blog/docs"
"blog/global"
"blog/initapp"
"blog/router"
"fmt"
"github.com/gin-gonic/gin"
)
const (
ValidationErrorMalformed uint32 = 1 << iota // Token is malformed
ValidationErrorUnverifiable // Token could not be verified because of signing problems
ValidationErrorSignatureInvalid // Signature validation failed
// Standard Claim validation errors
ValidationErrorAudience // AUD validation failed
ValidationErrorExpired // EXP validation failed
ValidationErrorIssuedAt // IAT validation failed
ValidationErrorIssuer // ISS validation failed
ValidationErrorNotValidYet // NBF validation failed
ValidationErrorId // JTI validation failed
ValidationErrorClaimsInvalid // Generic claims validation error
)
// @title blog后台
// @version 1.0 版本
// @description blog后台
// @host go.gzyezi.top
// @BasePath /
func main() {
global.GlobalInit()
initapp.MysqlRegister()
gin.SetMode(global.GM_CONFIG.GinConfig.RunMode)
global.GM_DB = initapp.GormMysql() // gorm连接数据库
if global.GM_DB != nil {
initapp.AutoTableInit(global.GM_DB) // 初始化表
db, _ := global.GM_DB.DB()
defer db.Close()
}
//如果是多服务器
//初始化
initapp.RedisInit()
if err := router.InitRouter().Run(
fmt.Sprintf(":%d", global.GM_CONFIG.GinConfig.Port)); err != nil {
panic(err)
}
}