1
0
mirror of https://github.com/astaxie/beego.git synced 2025-07-10 16:01:01 +00:00
This commit is contained in:
Faissal Elamraoui
2016-11-29 14:41:16 +01:00
committed by Faissal Elamraoui
parent 5bc3e30653
commit 39d40ba8fa
2 changed files with 22 additions and 3 deletions

View File

@ -193,10 +193,14 @@ func (c *ConfigContainer) DefaultStrings(key string, defaultval []string) []stri
// GetSection returns map for the given section
func (c *ConfigContainer) GetSection(section string) (map[string]string, error) {
if v, ok := c.data[section]; ok {
return v.(map[string]string), nil
if v, ok := c.data[section].(map[string]interface{}); ok {
mapstr := make(map[string]string)
for k, val := range v {
mapstr[k] = config.ToString(val)
}
return mapstr, nil
}
return nil, errors.New("not exist setction")
return nil, fmt.Errorf("section '%s' not found", section)
}
// SaveConfigFile save the config into file