1
0
mirror of https://github.com/astaxie/beego.git synced 2025-06-12 22:30:40 +00:00

Change key format

key format : ${ENV_PART||defaultValue} or  ${ENV_PART}
This commit is contained in:
ysqi
2016-03-29 21:47:33 +08:00
parent 5bd7d8c43f
commit 7e65338c87
10 changed files with 105 additions and 93 deletions

View File

@ -110,7 +110,7 @@ func ReadYmlReader(path string) (cnf map[string]interface{}, err error) {
log.Println("Not a Map? >> ", string(buf), data)
cnf = nil
}
cnf = config.ChooseRealValueForMap(cnf)
cnf = config.ExpandValueEnvForMap(cnf)
return
}

View File

@ -34,14 +34,8 @@ func TestYaml(t *testing.T) {
"autorender": false
"copyrequestbody": true
"PATH": GOPATH
"path1": $$GOPATH
"path2": $$GOPATH||/home/go
"path3": $$GOPATH$$GOPATH2||/home/go
"token1": $$TOKEN
"token2": $$TOKEN||
"token3": $$TOKEN||astaxie
"token4": token$$TOKEN
"token5": $$TOKEN$$TOKEN||TOKEN
"path1": ${GOPATH}
"path2": ${GOPATH||/home/go}
"empty": ""
`
@ -56,12 +50,6 @@ func TestYaml(t *testing.T) {
"PATH": "GOPATH",
"path1": os.Getenv("GOPATH"),
"path2": os.Getenv("GOPATH"),
"path3": "/home/go",
"token1": "",
"token2": "",
"token3": "astaxie",
"token4": "token$$TOKEN",
"token5": "TOKEN",
"error": "",
"emptystrings": []string{},
}