zrok/controller/metrics/config.go

29 lines
548 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/openziti/zrok/controller/store"
2023-03-03 19:51:10 +01:00
"github.com/pkg/errors"
)
2023-03-03 19:31:57 +01:00
type Config struct {
Source interface{}
Influx *InfluxConfig
Store *store.Config
}
type InfluxConfig struct {
Url string
Bucket string
Org string
Token string `cf:"+secret"`
2023-03-03 19:31:57 +01:00
}
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
}