MCPcopy Create free account
hub / github.com/cortexproject/cortex / LoadConfig

Function LoadConfig

tools/query-audit/config.go:55–67  ·  view source on GitHub ↗

LoadConfig read YAML-formatted config from filename into cfg.

(filename string, cfg *Config)

Source from the content-addressed store, hash-verified

53
54// LoadConfig read YAML-formatted config from filename into cfg.
55func LoadConfig(filename string, cfg *Config) error {
56 buf, err := os.ReadFile(filename)
57 if err != nil {
58 return errors.Wrap(err, "Error reading config file")
59 }
60
61 err = yaml.Unmarshal(buf, cfg)
62 if err != nil {
63 return errors.Wrap(err, "Error parsing config file")
64 }
65
66 return cfg.Validate()
67}

Callers 1

mainFunction · 0.70

Calls 3

WrapMethod · 0.65
UnmarshalMethod · 0.45
ValidateMethod · 0.45

Tested by

no test coverage detected