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

Function initConfig

config/configs.go:267–279  ·  view source on GitHub ↗
(configFile string, ctType string, parser func([]byte, interface{}) error)

Source from the content-addressed store, hash-verified

265}
266
267func initConfig(configFile string, ctType string, parser func([]byte, interface{}) error) (*Config, error) {
268 content, err := ioutil.ReadFile(configFile)
269 if err != nil {
270 return nil, errors.New("DotWeb:Config:initConfig current cType:" + ctType + " config file [" + configFile + "] cannot be parsed - " + err.Error())
271 }
272
273 var config *Config
274 err = parser(content, &config)
275 if err != nil {
276 return nil, errors.New("DotWeb:Config:initConfig current cType:" + ctType + " config file [" + configFile + "] cannot be parsed - " + err.Error())
277 }
278 return config, nil
279}

Callers 1

InitConfigFunction · 0.85

Calls 1

ErrorMethod · 0.65

Tested by

no test coverage detected