mirror of
https://github.com/astaxie/beego.git
synced 2024-11-25 22:01:29 +00:00
update config to change section . to ::
This commit is contained in:
parent
690ecb8168
commit
b97d9896a4
@ -154,7 +154,7 @@ func (c *IniConfigContainer) Set(key, value string) error {
|
|||||||
|
|
||||||
var section, k string
|
var section, k string
|
||||||
key = strings.ToLower(key)
|
key = strings.ToLower(key)
|
||||||
sectionkey := strings.Split(key, ".")
|
sectionkey := strings.Split(key, "::")
|
||||||
if len(sectionkey) >= 2 {
|
if len(sectionkey) >= 2 {
|
||||||
section = sectionkey[0]
|
section = sectionkey[0]
|
||||||
k = sectionkey[1]
|
k = sectionkey[1]
|
||||||
@ -184,7 +184,7 @@ func (c *IniConfigContainer) getdata(key string) string {
|
|||||||
|
|
||||||
var section, k string
|
var section, k string
|
||||||
key = strings.ToLower(key)
|
key = strings.ToLower(key)
|
||||||
sectionkey := strings.Split(key, ".")
|
sectionkey := strings.Split(key, "::")
|
||||||
if len(sectionkey) >= 2 {
|
if len(sectionkey) >= 2 {
|
||||||
section = sectionkey[0]
|
section = sectionkey[0]
|
||||||
k = sectionkey[1]
|
k = sectionkey[1]
|
||||||
|
@ -69,13 +69,13 @@ func TestIni(t *testing.T) {
|
|||||||
if iniconf.String("name") != "astaxie" {
|
if iniconf.String("name") != "astaxie" {
|
||||||
t.Fatal("get name error")
|
t.Fatal("get name error")
|
||||||
}
|
}
|
||||||
if iniconf.String("demo.key1") != "asta" {
|
if iniconf.String("demo::key1") != "asta" {
|
||||||
t.Fatal("get demo.key1 error")
|
t.Fatal("get demo.key1 error")
|
||||||
}
|
}
|
||||||
if iniconf.String("demo.key2") != "xie" {
|
if iniconf.String("demo::key2") != "xie" {
|
||||||
t.Fatal("get demo.key2 error")
|
t.Fatal("get demo.key2 error")
|
||||||
}
|
}
|
||||||
if v, err := iniconf.Bool("demo.caseinsensitive"); err != nil || v != true {
|
if v, err := iniconf.Bool("demo::caseinsensitive"); err != nil || v != true {
|
||||||
t.Fatal("get demo.caseinsensitive error")
|
t.Fatal("get demo.caseinsensitive error")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user