zrok/controller/metrics/config.go

19 lines
354 B
Go
Raw Normal View History

2023-03-03 19:31:57 +01:00
package metrics
2023-03-03 19:51:10 +01:00
import (
"github.com/michaelquigley/cf"
"github.com/pkg/errors"
)
2023-03-03 19:31:57 +01:00
type Config struct {
Source interface{}
}
2023-03-03 19:51:10 +01:00
func LoadConfig(path string) (*Config, error) {
cfg := &Config{}
if err := cf.BindYaml(cfg, path, GetCfOptions()); err != nil {
return nil, errors.Wrapf(err, "error loading config from '%v'", path)
}
return cfg, nil
}