func (c *AppConf) Load() *AppConf { if c.IsExist() { logger.Tracef("Load config. AppName:%s Location:%s", c.AppName, c.Location()) c.StringKeyValueMap = ini.NewIniConfig(c.Location()).LoadKeyValue() return c } logger.Tracef("Location not exists, Create Default StringKeyValueMap. AppName:%s", c.AppName) c.StringKeyValueMap = mcore.NewStringKeyValueMap() c.performLoad = false return c }
func Demo() { var c mconf.Config = mconf.NewConfig(ini.NewIniConfig("../data/demo.ini", "../data/demo2.ini")) c.Put("put", "temp put") demo.DemoConfig(c) fmt.Println(c.GetString("put")) }
// NewDBConfFromFile // file in ini format. func NewDBConfFromFile(location string) *DBConf { logger.Trace("NewDBConfFromFile() locaton: ", location) loader := ini.NewIniConfig(location) c := mconf.NewConfig(loader) return NewDBConfFromConfig(c) }