2023-02-02 10:55:24 +01:00
|
|
|
package server
|
|
|
|
|
2023-03-07 23:10:42 +01:00
|
|
|
import (
|
|
|
|
"forge.cadoles.com/Cadoles/emissary/internal/config"
|
|
|
|
)
|
2023-02-02 10:55:24 +01:00
|
|
|
|
|
|
|
type Option struct {
|
2023-03-07 23:10:42 +01:00
|
|
|
Config config.ServerConfig
|
2023-02-02 10:55:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
type OptionFunc func(*Option)
|
|
|
|
|
|
|
|
func defaultOption() *Option {
|
|
|
|
return &Option{
|
2023-03-07 23:10:42 +01:00
|
|
|
Config: config.NewDefaultServerConfig(),
|
2023-02-02 10:55:24 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-03-07 23:10:42 +01:00
|
|
|
func WithConfig(conf config.ServerConfig) OptionFunc {
|
2023-02-02 10:55:24 +01:00
|
|
|
return func(opt *Option) {
|
|
|
|
opt.Config = conf
|
|
|
|
}
|
|
|
|
}
|