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)
| 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. |
| 498 | func 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 | |
| 507 | func load(filename string, opener func(filename string) (jsonconfig.File, error)) (*Config, error) { |
| 508 | c := osutil.NewJSONConfigParser() |