Exemplo n.º 1
0
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
}
Exemplo n.º 2
0
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"))
}
Exemplo n.º 3
0
Arquivo: db.go Projeto: mabetle/mdb
// 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)
}