|
|
package config
|
|
|
|
|
|
import (
|
|
|
"fmt"
|
|
|
|
|
|
"github.com/astaxie/beego"
|
|
|
)
|
|
|
|
...
|
...
|
@@ -20,9 +22,17 @@ type MyConfig struct { |
|
|
var MConfig *MyConfig
|
|
|
|
|
|
func RestMyConfig() *MyConfig {
|
|
|
mysqlHost := beego.AppConfig.String("mysql_host")
|
|
|
mysqlPort := beego.AppConfig.String("mysql_port")
|
|
|
mysqlUser := beego.AppConfig.String("mysql_user")
|
|
|
mysqlPassword := beego.AppConfig.String("mysql_password")
|
|
|
mysqlDBname := beego.AppConfig.String("mysql_db_name")
|
|
|
sqlconn := fmt.Sprintf("%s:%s@tcp(%s:%s)/%s",
|
|
|
mysqlUser, mysqlPassword, mysqlHost, mysqlPort, mysqlDBname)
|
|
|
sqlconn = sqlconn + "?charset=utf8&loc=Asia%2FShanghai"
|
|
|
MConfig = &MyConfig{
|
|
|
ConfigName: beego.AppConfig.String("config_name"),
|
|
|
SqlConn: beego.AppConfig.String("sqlconn"),
|
|
|
SqlConn: sqlconn,
|
|
|
RedisAddPort: beego.AppConfig.String("redis_add_port"),
|
|
|
RedisAuth: beego.AppConfig.DefaultString("redis_auth", ""),
|
|
|
RedisDB: beego.AppConfig.DefaultString("redis_db", "0"),
|
...
|
...
|
@@ -30,6 +40,5 @@ func RestMyConfig() *MyConfig { |
|
|
LogFilename: beego.AppConfig.DefaultString("log_filename", "./log/ability.log"),
|
|
|
LogLevel: beego.AppConfig.DefaultString("log_Level", "debug"),
|
|
|
}
|
|
|
|
|
|
return MConfig
|
|
|
} |
...
|
...
|
|