1
0
mirror of https://github.com/astaxie/beego.git synced 2025-07-12 00:21:01 +00:00

Update config suport environment variable logic

This commit is contained in:
ysqi
2016-03-12 14:32:39 +08:00
parent 86c7f1db9e
commit b2a06c5fa0
10 changed files with 240 additions and 219 deletions

View File

@ -42,13 +42,20 @@ needlogin = ON
enableSession = Y
enableCookie = N
flag = 1
path = $ENV_GOROOT
path1 = $$GOROOT
path2 = $$GOROOT||/home/go
path3 = $$GOROOT$$GOPATH2||/home/go
token1 = $$TOKEN
token2 = $$TOKEN||
token3 = $$TOKEN||astaxie
token4 = token$$TOKEN
token5 = $$TOKEN$$TOKEN||TOKEN
[demo]
key1="asta"
key2 = "xie"
CaseInsensitive = true
peers = one;two;three
password = $ENV_GOROOT
password = $$GOROOT
`
keyValue = map[string]interface{}{
@ -66,7 +73,14 @@ password = $ENV_GOROOT
"enableSession": true,
"enableCookie": false,
"flag": true,
"path": os.Getenv("GOROOT"),
"path1": os.Getenv("GOROOT"),
"path2": os.Getenv("GOROOT"),
"path3": "/home/go",
"token1": "",
"token2": "",
"token3": "astaxie",
"token4": "token$$TOKEN",
"token5": "TOKEN",
"demo::key1": "asta",
"demo::key2": "xie",
"demo::CaseInsensitive": true,
@ -145,7 +159,6 @@ httpport = 8080
# db type name
# suport mysql,sqlserver
name = mysql
path = $ENV_GOROOT
`
saveResult = `
@ -162,7 +175,6 @@ httpport=8080
# db type name
# suport mysql,sqlserver
name=mysql
path=$ENV_GOROOT
`
)
cfg, err := NewConfigData("ini", []byte(inicontext))