api/pkg/config/multi_handler_config.go

26 lines
496 B
Go
Raw Normal View History

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
}