in pkg/config/config.go [143:161]
func From(source []byte) (*Config, error) {
config := &Config{}
// Read file as yaml
err := yaml.Unmarshal(source, config)
if err != nil {
return nil, err
}
// Set priority given the position in the array
for i := range config.MetricServers {
config.MetricServers[i].Priority = i
}
// Ensure that configuration is valid and compile the patterns.
if err := validate(config); err != nil {
return nil, err
}
return config, nil
}