elaborating controller config (#23)

This commit is contained in:
Michael Quigley 2022-08-09 11:18:24 -04:00
parent 4d427894ea
commit 8606072b80
No known key found for this signature in database
GPG Key ID: 9B60314A9DD20A62
3 changed files with 18 additions and 7 deletions

View File

@ -43,8 +43,10 @@ func (cmd *controllerCommand) run(_ *cobra.Command, _ []string) {
panic(err)
}
if err := controller.Run(&controller.Config{
Host: host,
Port: port,
Endpoint: controller.EndpointConfig{
Host: host,
Port: port,
},
Store: &store.Config{Path: cmd.dbPath},
}); err != nil {
panic(err)

View File

@ -3,7 +3,16 @@ package controller
import "github.com/openziti-test-kitchen/zrok/controller/store"
type Config struct {
Host string
Port int
Store *store.Config
Endpoint EndpointConfig
Proxy ProxyConfig
Store *store.Config
}
type EndpointConfig struct {
Host string
Port int
}
type ProxyConfig struct {
UrlTemplate string
}

View File

@ -39,8 +39,8 @@ func Run(cfg *Config) error {
server := rest_server_zrok.NewServer(api)
defer func() { _ = server.Shutdown() }()
server.Host = cfg.Host
server.Port = cfg.Port
server.Host = cfg.Endpoint.Host
server.Port = cfg.Endpoint.Port
server.ConfigureAPI()
if err := server.Serve(); err != nil {
return errors.Wrap(err, "api server error")