123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- package main
- import (
- "Panel_development/app"
- "Panel_development/database"
- "Panel_development/global"
- "Panel_development/nats"
- "Panel_development/simple_zap"
- "Panel_development/unity"
- "context"
- )
- func init() {
- //err := global.SetupSetting()
- //if err != nil {
- // simple_zap.WithCtx(context.Background()).Sugar().Warn(err, "配置文件读取失败")
- //}
- err := global.SetupDBLink()
- if err != nil {
- simple_zap.WithCtx(context.Background()).Sugar().Warn(err, "数据库连接失败")
- }
- // 数据库迁移
- database.Migrate(global.DBLink)
- //本地化
- if err = unity.Translator("zh"); err != nil {
- simple_zap.WithCtx(context.Background()).Sugar().Warn(err, "注册本地化失败")
- }
- //nats
- nats.SetupNats()
- }
- // @title 面板开发
- // @version 1.0
- // @description 面板开发
- // @Host 127.0.0.1:8081
- // @BasePath /api
- //
- //go:generate swag init --parseDependency --parseDepth=6
- func main() {
- err := app.InitRouter()
- if err != nil {
- simple_zap.WithCtx(context.Background()).Sugar().Warn(err, "项目初始化失败")
- return
- }
- }
|