32 lines
629 B
Go
32 lines
629 B
Go
|
package admin
|
||
|
|
||
|
import (
|
||
|
"forge.cadoles.com/cadoles/bouncer/internal/config"
|
||
|
)
|
||
|
|
||
|
type Option struct {
|
||
|
ServerConfig config.AdminServerConfig
|
||
|
DatabaseConfig config.DatabaseConfig
|
||
|
}
|
||
|
|
||
|
type OptionFunc func(*Option)
|
||
|
|
||
|
func defaultOption() *Option {
|
||
|
return &Option{
|
||
|
ServerConfig: config.NewDefaultAdminServerConfig(),
|
||
|
DatabaseConfig: config.NewDefaultDatabaseConfig(),
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func WithServerConfig(conf config.AdminServerConfig) OptionFunc {
|
||
|
return func(opt *Option) {
|
||
|
opt.ServerConfig = conf
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func WithDatabaseConfig(conf config.DatabaseConfig) OptionFunc {
|
||
|
return func(opt *Option) {
|
||
|
opt.DatabaseConfig = conf
|
||
|
}
|
||
|
}
|