mirror of
https://github.com/openziti/zrok.git
synced 2024-11-29 03:24:15 +01:00
66 lines
1.2 KiB
Go
66 lines
1.2 KiB
Go
package controller
|
|
|
|
import (
|
|
"github.com/michaelquigley/cf"
|
|
"github.com/openziti-test-kitchen/zrok/controller/store"
|
|
"github.com/pkg/errors"
|
|
)
|
|
|
|
type Config struct {
|
|
Endpoint *EndpointConfig
|
|
Proxy *ProxyConfig
|
|
Email *EmailConfig
|
|
Registration *RegistrationConfig
|
|
Store *store.Config
|
|
Ziti *ZitiConfig
|
|
Metrics *MetricsConfig
|
|
Influx *InfluxConfig
|
|
}
|
|
|
|
type EndpointConfig struct {
|
|
Host string
|
|
Port int
|
|
}
|
|
|
|
type ProxyConfig struct {
|
|
UrlTemplate string
|
|
Identities []string
|
|
}
|
|
|
|
type EmailConfig struct {
|
|
Host string
|
|
Port int
|
|
Username string
|
|
Password string `cf:"+secret"`
|
|
}
|
|
|
|
type RegistrationConfig struct {
|
|
EmailFrom string
|
|
RegistrationUrlTemplate string
|
|
}
|
|
|
|
type ZitiConfig struct {
|
|
ApiEndpoint string
|
|
Username string
|
|
Password string `cf:"+secret"`
|
|
}
|
|
|
|
type MetricsConfig struct {
|
|
ServiceName string
|
|
}
|
|
|
|
type InfluxConfig struct {
|
|
Url string
|
|
Bucket string
|
|
Org string
|
|
Token string `cf:"+secret"`
|
|
}
|
|
|
|
func LoadConfig(path string) (*Config, error) {
|
|
cfg := &Config{}
|
|
if err := cf.BindYaml(cfg, path, cf.DefaultOptions()); err != nil {
|
|
return nil, errors.Wrapf(err, "error loading controller config '%v'", path)
|
|
}
|
|
return cfg, nil
|
|
}
|