package utils import ( beeLogger "github.com/beego/bee/v2/logger" "github.com/beego/beego/v2/server/web" ) var ( RunMode string //运行模式 MYSQL_URL string //数据库连接 MYSQL_URL_DATA string ) func init() { tmpRunMode, err := web.AppConfig.String("run_mode") if err != nil { panic("配置文件读取run_mode错误 " + err.Error()) } RunMode = tmpRunMode config, err := web.AppConfig.GetSection(RunMode) if err != nil { panic("配置文件读取错误 " + err.Error()) } beeLogger.Log.Info(RunMode + " 模式") MYSQL_URL = config["mysql_url"] MYSQL_URL_DATA = config["mysql_url_data"] if RunMode == "release" { } else { } }