Peter Kurfer
49e58ac2e4
- move to Gitlab - make code better testable - create app abstraction for server - cleanup
25 lines
496 B
Go
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
|
|
}
|