2023-03-03 19:31:57 +01:00
|
|
|
package metrics
|
|
|
|
|
2023-03-03 19:51:10 +01:00
|
|
|
import (
|
|
|
|
"github.com/michaelquigley/cf"
|
2023-03-07 21:27:39 +01:00
|
|
|
"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{}
|
2023-03-07 18:57:35 +01:00
|
|
|
Influx *InfluxConfig
|
2023-03-07 21:27:39 +01:00
|
|
|
Store *store.Config
|
2023-03-07 18:57:35 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
|
}
|