沈阳玫苑物业管理后端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

69 lines
1.5 KiB

package parse
import (
"lapp_-wy/conf"
"fmt"
"github.com/kataras/golog"
"github.com/kataras/iris"
)
var (
// conf strut
C iris.Configuration
// 解析app.yml中的Other项
O Other
// app.conf配置项key定义
ignoreURLs string = "IgnoreURLs"
jwtTimeout string = "JWTTimeout"
logLevel string = "LogLevel"
secret string = "Secret"
)
type (
Other struct {
IgnoreURLs []string
JWTTimeout int64
LogLevel string
Secret string
}
)
func AppOtherParse() {
golog.Info("@@@ Init app conf")
//c := iris.YAML("conf/app.yml")
appData := conf.AppConfig
c := iris.DefaultConfiguration()
c.DisableBodyConsumptionOnUnmarshal = appData.DisableBodyConsumptionOnUnmarshal
c.DisablePathCorrection = appData.DisablePathCorrection
c.EnablePathEscape = appData.EnablePathEscape
c.FireMethodNotAllowed = appData.FireMethodNotAllowed
c.TimeFormat = appData.TimeFormat
c.Charset = appData.Charset
other := make(map[string]interface{},0)
other["IgnoreURLs"] = appData.Other.IgnoreURLs;
other["JWTTimeout"] = appData.Other.JWTTimeout;
//关闭路由log日志
other["LogLevel"] = appData.Other.LogLevel;
other["Secret"] = appData.Other.Secret;
c.Other = other
C = c
// 解析other的key
iURLs := c.GetOther()[ignoreURLs].([]string)
fmt.Println(iURLs)
for _, v := range iURLs {
O.IgnoreURLs = append(O.IgnoreURLs, v)
}
jTimeout := c.GetOther()[jwtTimeout].(int64)
O.JWTTimeout = int64(jTimeout)
//golog.Info(reflect.TypeOf(O.JWTTimeout))
O.LogLevel = c.GetOther()[logLevel].(string)
O.Secret = c.GetOther()[secret].(string)
}