emissary/internal/server/option.go

24 lines
370 B
Go
Raw Normal View History

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