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

Merge branch 'astaxie/develop' into environmentVar

# Conflicts:
#	config/fake.go
#	config/xml/xml_test.go
#	config/yaml/yaml_test.go
This commit is contained in:
ysqi
2016-03-10 19:57:16 +08:00
52 changed files with 1205 additions and 336 deletions

View File

@ -269,15 +269,20 @@ func (c *IniConfigContainer) DefaultString(key string, defaultval string) string
}
// Strings returns the []string value for a given key.
// Return nil if config value does not exist or is empty.
func (c *IniConfigContainer) Strings(key string) []string {
return strings.Split(c.String(key), ";")
v := c.String(key)
if v == "" {
return nil
}
return strings.Split(v, ";")
}
// DefaultStrings returns the []string value for a given key.
// if err != nil return defaltval
func (c *IniConfigContainer) DefaultStrings(key string, defaultval []string) []string {
v := c.Strings(key)
if len(v) == 0 {
if v == nil {
return defaultval
}
return v