refactor: remove redis direct references from proxy/admin servers
This commit is contained in:
@ -3,13 +3,19 @@ package admin
|
||||
import (
|
||||
"forge.cadoles.com/cadoles/bouncer/internal/config"
|
||||
"forge.cadoles.com/cadoles/bouncer/internal/integration"
|
||||
"forge.cadoles.com/cadoles/bouncer/internal/lock"
|
||||
"forge.cadoles.com/cadoles/bouncer/internal/store"
|
||||
)
|
||||
|
||||
type Option struct {
|
||||
BootstrapConfig config.BootstrapConfig
|
||||
ServerConfig config.AdminServerConfig
|
||||
RedisConfig config.RedisConfig
|
||||
Integrations []integration.Integration
|
||||
|
||||
ProxyRepository store.ProxyRepository
|
||||
LayerRepository store.LayerRepository
|
||||
|
||||
Locker lock.Locker
|
||||
}
|
||||
|
||||
type OptionFunc func(*Option)
|
||||
@ -17,7 +23,6 @@ type OptionFunc func(*Option)
|
||||
func defaultOption() *Option {
|
||||
return &Option{
|
||||
ServerConfig: config.NewDefaultAdminServerConfig(),
|
||||
RedisConfig: config.NewDefaultRedisConfig(),
|
||||
Integrations: make([]integration.Integration, 0),
|
||||
}
|
||||
}
|
||||
@ -28,12 +33,6 @@ func WithServerConfig(conf config.AdminServerConfig) OptionFunc {
|
||||
}
|
||||
}
|
||||
|
||||
func WithRedisConfig(conf config.RedisConfig) OptionFunc {
|
||||
return func(opt *Option) {
|
||||
opt.RedisConfig = conf
|
||||
}
|
||||
}
|
||||
|
||||
func WithBootstrapConfig(conf config.BootstrapConfig) OptionFunc {
|
||||
return func(opt *Option) {
|
||||
opt.BootstrapConfig = conf
|
||||
@ -45,3 +44,21 @@ func WithIntegrations(integrations ...integration.Integration) OptionFunc {
|
||||
opt.Integrations = integrations
|
||||
}
|
||||
}
|
||||
|
||||
func WithLayerRepository(layerRepository store.LayerRepository) OptionFunc {
|
||||
return func(opt *Option) {
|
||||
opt.LayerRepository = layerRepository
|
||||
}
|
||||
}
|
||||
|
||||
func WithProxyRepository(proxyRepository store.ProxyRepository) OptionFunc {
|
||||
return func(opt *Option) {
|
||||
opt.ProxyRepository = proxyRepository
|
||||
}
|
||||
}
|
||||
|
||||
func WithLocker(locker lock.Locker) OptionFunc {
|
||||
return func(opt *Option) {
|
||||
opt.Locker = locker
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user