Refactor Namespace Resolver

This commit is contained in:
Ben Toogood
2020-04-07 16:24:51 +01:00
parent 3df87510a1
commit 4362a885eb
8 changed files with 53 additions and 172 deletions

View File

@@ -10,15 +10,14 @@ import (
type Option func(o *Options)
type Options struct {
EnableACME bool
EnableCORS bool
ACMEProvider acme.Provider
EnableTLS bool
ACMEHosts []string
TLSConfig *tls.Config
Resolver resolver.Resolver
Namespace string
ServicePrefix string
EnableACME bool
EnableCORS bool
ACMEProvider acme.Provider
EnableTLS bool
ACMEHosts []string
TLSConfig *tls.Config
Resolver resolver.Resolver
NamespaceResolver resolver.NamespaceResolver
}
func EnableCORS(b bool) Option {
@@ -57,20 +56,14 @@ func TLSConfig(t *tls.Config) Option {
}
}
func ServicePrefix(n string) Option {
return func(o *Options) {
o.ServicePrefix = n
}
}
func Namespace(n string) Option {
return func(o *Options) {
o.Namespace = n
}
}
func Resolver(r resolver.Resolver) Option {
return func(o *Options) {
o.Resolver = r
}
}
func NamespaceResolver(r resolver.NamespaceResolver) Option {
return func(o *Options) {
o.NamespaceResolver = r
}
}