bouncer/internal/proxy/option.go

32 lines
629 B
Go
Raw Permalink Normal View History

2023-04-24 20:52:12 +02:00
package proxy
import (
"forge.cadoles.com/cadoles/bouncer/internal/config"
)
type Option struct {
ServerConfig config.ProxyServerConfig
DatabaseConfig config.DatabaseConfig
}
type OptionFunc func(*Option)
func defaultOption() *Option {
return &Option{
ServerConfig: config.NewDefaultProxyServerConfig(),
DatabaseConfig: config.NewDefaultDatabaseConfig(),
}
}
func WithServerConfig(conf config.ProxyServerConfig) OptionFunc {
return func(opt *Option) {
opt.ServerConfig = conf
}
}
func WithDatabaseConfig(conf config.DatabaseConfig) OptionFunc {
return func(opt *Option) {
opt.DatabaseConfig = conf
}
}