IncludeConfigSet include ConfigSet file to Dotweb.Config.ConfigSet, can use ctx.ConfigSet to use your data same key will cover oldest value support xml\json\yaml
(configFile string, confType string)
| 144 | // same key will cover oldest value |
| 145 | // support xml\json\yaml |
| 146 | func (conf *Config) IncludeConfigSet(configFile string, confType string) error { |
| 147 | var parseItem core.ConcurrenceMap |
| 148 | var err error |
| 149 | if confType == ConfigType_XML { |
| 150 | parseItem, err = ParseConfigSetXML(configFile) |
| 151 | } |
| 152 | if confType == ConfigType_JSON { |
| 153 | parseItem, err = ParseConfigSetJSON(configFile) |
| 154 | } |
| 155 | if confType == ConfigType_Yaml { |
| 156 | parseItem, err = ParseConfigSetYaml(configFile) |
| 157 | } |
| 158 | if err != nil { |
| 159 | return err |
| 160 | } |
| 161 | items := conf.ConfigSet.(*core.ItemMap) |
| 162 | if items == nil { |
| 163 | return errors.New("init config items error") |
| 164 | } |
| 165 | for k, v := range parseItem.GetCurrentMap() { |
| 166 | items.Set(k, v) |
| 167 | } |
| 168 | return nil |
| 169 | } |
| 170 | |
| 171 | func NewAppNode() *AppNode { |
| 172 | config := &AppNode{} |
no test coverage detected