mirror of
https://github.com/openziti/zrok.git
synced 2025-06-25 12:12:32 +02:00
elaborating controller config (#23)
This commit is contained in:
parent
4d427894ea
commit
8606072b80
@ -43,8 +43,10 @@ func (cmd *controllerCommand) run(_ *cobra.Command, _ []string) {
|
|||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
if err := controller.Run(&controller.Config{
|
if err := controller.Run(&controller.Config{
|
||||||
Host: host,
|
Endpoint: controller.EndpointConfig{
|
||||||
Port: port,
|
Host: host,
|
||||||
|
Port: port,
|
||||||
|
},
|
||||||
Store: &store.Config{Path: cmd.dbPath},
|
Store: &store.Config{Path: cmd.dbPath},
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
|
@ -3,7 +3,16 @@ package controller
|
|||||||
import "github.com/openziti-test-kitchen/zrok/controller/store"
|
import "github.com/openziti-test-kitchen/zrok/controller/store"
|
||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
Host string
|
Endpoint EndpointConfig
|
||||||
Port int
|
Proxy ProxyConfig
|
||||||
Store *store.Config
|
Store *store.Config
|
||||||
|
}
|
||||||
|
|
||||||
|
type EndpointConfig struct {
|
||||||
|
Host string
|
||||||
|
Port int
|
||||||
|
}
|
||||||
|
|
||||||
|
type ProxyConfig struct {
|
||||||
|
UrlTemplate string
|
||||||
}
|
}
|
||||||
|
@ -39,8 +39,8 @@ func Run(cfg *Config) error {
|
|||||||
|
|
||||||
server := rest_server_zrok.NewServer(api)
|
server := rest_server_zrok.NewServer(api)
|
||||||
defer func() { _ = server.Shutdown() }()
|
defer func() { _ = server.Shutdown() }()
|
||||||
server.Host = cfg.Host
|
server.Host = cfg.Endpoint.Host
|
||||||
server.Port = cfg.Port
|
server.Port = cfg.Endpoint.Port
|
||||||
server.ConfigureAPI()
|
server.ConfigureAPI()
|
||||||
if err := server.Serve(); err != nil {
|
if err := server.Serve(); err != nil {
|
||||||
return errors.Wrap(err, "api server error")
|
return errors.Wrap(err, "api server error")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user