MCPcopy
hub / github.com/perkeep/perkeep / Load

Function Load

pkg/serverinit/serverinit.go:498–505  ·  view source on GitHub ↗

Load returns a low-level "handler config" from the provided config. If the config doesn't contain a top-level JSON key of "handlerConfig" with boolean value true, the configuration is assumed to be a high-level "user config" file, and transformed into a low-level config.

(config []byte)

Source from the content-addressed store, hash-verified

496// with boolean value true, the configuration is assumed to be a high-level
497// "user config" file, and transformed into a low-level config.
498func Load(config []byte) (*Config, error) {
499 return load("", func(filename string) (jsonconfig.File, error) {
500 if filename != "" {
501 return nil, errors.New("JSON files with includes not supported with jsonconfig.Load")
502 }
503 return jsonFileImpl{bytes.NewReader(config), "config file"}, nil
504 })
505}
506
507func load(filename string, opener func(filename string) (jsonconfig.File, error)) (*Config, error) {
508 c := osutil.NewJSONConfigParser()

Callers 3

TestInstallHandlersFunction · 0.92
loadConfigFunction · 0.92

Calls 1

loadFunction · 0.85

Tested by 2

TestInstallHandlersFunction · 0.74