zrok/controller/config.go
2022-08-10 11:56:00 -04:00

32 lines
605 B
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
Store *store.Config
}
type EndpointConfig struct {
Host string
Port int
}
type ProxyConfig struct {
UrlTemplate string
Identities []string
}
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
}