William Petit
e66938f1d3
All checks were successful
Cadoles/bouncer/pipeline/head This commit looks good
41 lines
880 B
Go
41 lines
880 B
Go
package proxy
|
|
|
|
import (
|
|
"forge.cadoles.com/cadoles/bouncer/internal/config"
|
|
"forge.cadoles.com/cadoles/bouncer/internal/proxy/director"
|
|
)
|
|
|
|
type Option struct {
|
|
ServerConfig config.ProxyServerConfig
|
|
RedisConfig config.RedisConfig
|
|
DirectorLayers []director.Layer
|
|
}
|
|
|
|
type OptionFunc func(*Option)
|
|
|
|
func defaultOption() *Option {
|
|
return &Option{
|
|
ServerConfig: config.NewDefaultProxyServerConfig(),
|
|
RedisConfig: config.NewDefaultRedisConfig(),
|
|
DirectorLayers: make([]director.Layer, 0),
|
|
}
|
|
}
|
|
|
|
func WithServerConfig(conf config.ProxyServerConfig) OptionFunc {
|
|
return func(opt *Option) {
|
|
opt.ServerConfig = conf
|
|
}
|
|
}
|
|
|
|
func WithRedisConfig(conf config.RedisConfig) OptionFunc {
|
|
return func(opt *Option) {
|
|
opt.RedisConfig = conf
|
|
}
|
|
}
|
|
|
|
func WithDirectorLayers(layers ...director.Layer) OptionFunc {
|
|
return func(opt *Option) {
|
|
opt.DirectorLayers = layers
|
|
}
|
|
}
|