config.go 946 字节
package config

import (
	"github.com/astaxie/beego"
)

//MyConfig 自定义配置选项
type MyConfig struct {
	ConfigName   string //配置名称
	SqlConn      string //数据库连接
	RedisAddPort string //
	RedisAuth    string
	RedisDB      string
	LogOutput    string
	LogFilename  string
	LogLevel     string
}

//MConfig
var MConfig *MyConfig

func RestMyConfig() *MyConfig {
	MConfig = &MyConfig{
		ConfigName:   beego.AppConfig.String("config_name"),
		SqlConn:      beego.AppConfig.String("sqlconn"),
		RedisAddPort: beego.AppConfig.String("redis_add_port"),
		RedisAuth:    beego.AppConfig.DefaultString("redis_auth", ""),
		RedisDB:      beego.AppConfig.DefaultString("redis_db", "0"),
		LogOutput:    beego.AppConfig.DefaultString("log_output", "console"),
		LogFilename:  beego.AppConfig.DefaultString("log_filename", "./log/ability.log"),
		LogLevel:     beego.AppConfig.DefaultString("log_Level", "debug"),
	}

	return MConfig
}