controller config defaults

This commit is contained in:
Michael Quigley 2023-01-12 15:12:48 -05:00
parent 63edd0ed48
commit 7324c01fe8
No known key found for this signature in database
GPG Key ID: 9B60314A9DD20A62

View File

@ -59,10 +59,14 @@ type InfluxConfig struct {
Token string `cf:"+secret"` Token string `cf:"+secret"`
} }
func LoadConfig(path string) (*Config, error) { func DefaultConfig() *Config {
cfg := &Config{ return &Config{
Metrics: &MetricsConfig{ServiceName: "metrics"}, Metrics: &MetricsConfig{ServiceName: "metrics"},
} }
}
func LoadConfig(path string) (*Config, error) {
cfg := DefaultConfig()
if err := cf.BindYaml(cfg, path, cf.DefaultOptions()); err != nil { if err := cf.BindYaml(cfg, path, cf.DefaultOptions()); err != nil {
return nil, errors.Wrapf(err, "error loading controller config '%v'", path) return nil, errors.Wrapf(err, "error loading controller config '%v'", path)
} }