MCPcopy Create free account
hub / github.com/devfeel/dotweb / IncludeConfigSet

Method IncludeConfigSet

config/configs.go:146–169  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

144// same key will cover oldest value
145// support xml\json\yaml
146func (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
171func NewAppNode() *AppNode {
172 config := &AppNode{}

Callers 1

mainFunction · 0.80

Calls 5

GetCurrentMapMethod · 0.95
ParseConfigSetXMLFunction · 0.85
ParseConfigSetJSONFunction · 0.85
ParseConfigSetYamlFunction · 0.85
SetMethod · 0.65

Tested by

no test coverage detected