api/pkg/config/multi_handler_config.go
Peter Kurfer 49e58ac2e4 Add advanced matching options to HTTP handler
- move to Gitlab
- make code better testable
- create app abstraction for server
- cleanup
2020-12-26 13:11:49 +00:00

25 lines
496 B
Go

package config
import (
"github.com/spf13/viper"
)
type EndpointConfig struct {
Handler string
Ports []uint16
ListenAddress string
Options *viper.Viper
}
func (m EndpointConfig) HandlerConfigs() []HandlerConfig {
configs := make([]HandlerConfig, 0)
for _, port := range m.Ports {
configs = append(configs, HandlerConfig{
HandlerName: m.Handler,
Port: port,
ListenAddress: m.ListenAddress,
Options: m.Options,
})
}
return configs
}