1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- package main
- import (
- _ "go.uber.org/automaxprocs"
- "go.uber.org/zap"
- "log"
- "server/service/admin"
- "server/utils/logger"
- "server/core"
- "server/global"
- "server/initialize"
- )
- //go:generate go env -w GO111MODULE=on
- //go:generate go env -w GOPROXY=https://goproxy.cn,direct
- //go:generate go mod tidy
- //go:generate go mod download
- // @title Gin-Vue-Admin Swagger API接口文档
- // @version v2.6.3
- // @description 使用gin+vue进行极速开发的全栈开发基础平台
- // @securityDefinitions.apikey ApiKeyAuth
- // @in header
- // @name x-token
- // @BasePath /
- func main() {
- global.GVA_VP = core.Viper() // 初始化Viper
- logPath := "./logs/app.log"
- if err := logger.Initialize(logPath); err != nil {
- log.Fatalf("Failed to initialize logger: %v", err)
- }
- initialize.OtherInit()
- global.GVA_LOG = core.Zap() // 初始化zap日志库
- zap.ReplaceGlobals(global.GVA_LOG)
- global.GVA_DB = initialize.Gorm() // gorm连接数据库
- initialize.Timer()
- initialize.DBList()
- admin.InitMqtt() //mqtt
- if global.GVA_DB != nil {
- initialize.RegisterTables() // 初始化表
- // 程序结束前关闭数据库链接
- db, _ := global.GVA_DB.DB()
- defer db.Close()
- }
- core.RunWindowsServer()
- }
|