mirror of
https://github.com/caddyserver/caddy.git
synced 2024-12-16 21:56:40 -05:00
r/RegisterType/RegisterNamespace/g
Co-Author: Matt Holt
This commit is contained in:
parent
52441e3037
commit
18b346f6f9
15 changed files with 23 additions and 23 deletions
2
admin.go
2
admin.go
|
@ -55,7 +55,7 @@ func init() {
|
||||||
if env, exists := os.LookupEnv("CADDY_ADMIN"); exists {
|
if env, exists := os.LookupEnv("CADDY_ADMIN"); exists {
|
||||||
DefaultAdminListen = env
|
DefaultAdminListen = env
|
||||||
}
|
}
|
||||||
RegisterType("caddy.config_loaders", []interface{}{(*ConfigLoader)(nil)})
|
RegisterNamespace("caddy.config_loaders", []interface{}{(*ConfigLoader)(nil)})
|
||||||
}
|
}
|
||||||
|
|
||||||
// AdminConfig configures Caddy's API endpoint, which is used
|
// AdminConfig configures Caddy's API endpoint, which is used
|
||||||
|
|
4
caddy.go
4
caddy.go
|
@ -42,10 +42,10 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
RegisterType("", []interface{}{
|
RegisterNamespace("", []interface{}{
|
||||||
(*App)(nil),
|
(*App)(nil),
|
||||||
})
|
})
|
||||||
RegisterType("caddy.storage", []interface{}{
|
RegisterNamespace("caddy.storage", []interface{}{
|
||||||
(*StorageConverter)(nil),
|
(*StorageConverter)(nil),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
RegisterType("caddy.listeners", []interface{}{
|
RegisterNamespace("caddy.listeners", []interface{}{
|
||||||
(*ListenerWrapper)(nil),
|
(*ListenerWrapper)(nil),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,10 +33,10 @@ func init() {
|
||||||
RegisterModule(StdoutWriter{})
|
RegisterModule(StdoutWriter{})
|
||||||
RegisterModule(StderrWriter{})
|
RegisterModule(StderrWriter{})
|
||||||
RegisterModule(DiscardWriter{})
|
RegisterModule(DiscardWriter{})
|
||||||
RegisterType("caddy.logging.encoders", []interface{}{
|
RegisterNamespace("caddy.logging.encoders", []interface{}{
|
||||||
(*zapcore.Encoder)(nil),
|
(*zapcore.Encoder)(nil),
|
||||||
})
|
})
|
||||||
RegisterType("caddy.logging.writers", []interface{}{
|
RegisterNamespace("caddy.logging.writers", []interface{}{
|
||||||
(*WriterOpener)(nil),
|
(*WriterOpener)(nil),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,10 +32,10 @@ import (
|
||||||
func init() {
|
func init() {
|
||||||
caddy.RegisterModule(HTTPBasicAuth{})
|
caddy.RegisterModule(HTTPBasicAuth{})
|
||||||
|
|
||||||
caddy.RegisterType("http.authentication.hashes", []interface{}{
|
caddy.RegisterNamespace("http.authentication.hashes", []interface{}{
|
||||||
(*Comparer)(nil),
|
(*Comparer)(nil),
|
||||||
})
|
})
|
||||||
caddy.RegisterType("http.authentication.providers", []interface{}{
|
caddy.RegisterNamespace("http.authentication.providers", []interface{}{
|
||||||
(*Authenticator)(nil),
|
(*Authenticator)(nil),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ import (
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
caddy.RegisterModule(Encode{})
|
caddy.RegisterModule(Encode{})
|
||||||
caddy.RegisterType("http.encoders", []interface{}{
|
caddy.RegisterNamespace("http.encoders", []interface{}{
|
||||||
(*Encoding)(nil),
|
(*Encoding)(nil),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
caddy.RegisterType("http.precompressed", []interface{}{
|
caddy.RegisterNamespace("http.precompressed", []interface{}{
|
||||||
(*encode.Precompressed)(nil),
|
(*encode.Precompressed)(nil),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -214,7 +214,7 @@ func init() {
|
||||||
caddy.RegisterModule(MatchHeaderRE{})
|
caddy.RegisterModule(MatchHeaderRE{})
|
||||||
caddy.RegisterModule(new(MatchProtocol))
|
caddy.RegisterModule(new(MatchProtocol))
|
||||||
caddy.RegisterModule(MatchNot{})
|
caddy.RegisterModule(MatchNot{})
|
||||||
caddy.RegisterType("http.matchers", []interface{}{
|
caddy.RegisterNamespace("http.matchers", []interface{}{
|
||||||
(*RequestMatcher)(nil),
|
(*RequestMatcher)(nil),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,16 +46,16 @@ import (
|
||||||
func init() {
|
func init() {
|
||||||
caddy.RegisterModule(Handler{})
|
caddy.RegisterModule(Handler{})
|
||||||
|
|
||||||
caddy.RegisterType("http.reverse_proxy.circuit_breakers", []interface{}{
|
caddy.RegisterNamespace("http.reverse_proxy.circuit_breakers", []interface{}{
|
||||||
(*CircuitBreaker)(nil),
|
(*CircuitBreaker)(nil),
|
||||||
})
|
})
|
||||||
caddy.RegisterType("http.reverse_proxy.selection_policies", []interface{}{
|
caddy.RegisterNamespace("http.reverse_proxy.selection_policies", []interface{}{
|
||||||
(*Selector)(nil),
|
(*Selector)(nil),
|
||||||
})
|
})
|
||||||
caddy.RegisterType("http.reverse_proxy.transport", []interface{}{
|
caddy.RegisterNamespace("http.reverse_proxy.transport", []interface{}{
|
||||||
(*http.RoundTripper)(nil),
|
(*http.RoundTripper)(nil),
|
||||||
})
|
})
|
||||||
caddy.RegisterType("http.reverse_proxy.upstreams", []interface{}{
|
caddy.RegisterNamespace("http.reverse_proxy.upstreams", []interface{}{
|
||||||
(*UpstreamSource)(nil),
|
(*UpstreamSource)(nil),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
caddy.RegisterType("http.handlers", []interface{}{
|
caddy.RegisterNamespace("http.handlers", []interface{}{
|
||||||
(*MiddlewareHandler)(nil),
|
(*MiddlewareHandler)(nil),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,13 +31,13 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
caddy.RegisterType("dns.provider", []interface{}{
|
caddy.RegisterNamespace("dns.provider", []interface{}{
|
||||||
(*acmez.Solver)(nil),
|
(*acmez.Solver)(nil),
|
||||||
})
|
})
|
||||||
caddy.RegisterType("tls.get_certificate", []interface{}{
|
caddy.RegisterNamespace("tls.get_certificate", []interface{}{
|
||||||
(*certmagic.Manager)(nil),
|
(*certmagic.Manager)(nil),
|
||||||
})
|
})
|
||||||
caddy.RegisterType("tls.issuance", []interface{}{
|
caddy.RegisterNamespace("tls.issuance", []interface{}{
|
||||||
(*certmagic.Issuer)(nil),
|
(*certmagic.Issuer)(nil),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ import (
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
caddy.RegisterModule(LeafCertClientAuth{})
|
caddy.RegisterModule(LeafCertClientAuth{})
|
||||||
caddy.RegisterType("tls.handshake_match", []interface{}{
|
caddy.RegisterNamespace("tls.handshake_match", []interface{}{
|
||||||
(*ConnectionMatcher)(nil),
|
(*ConnectionMatcher)(nil),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
caddy.RegisterType("tls.stek", []interface{}{
|
caddy.RegisterNamespace("tls.stek", []interface{}{
|
||||||
(*STEKProvider)(nil),
|
(*STEKProvider)(nil),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@ func init() {
|
||||||
caddy.RegisterModule(TLS{})
|
caddy.RegisterModule(TLS{})
|
||||||
caddy.RegisterModule(AutomateLoader{})
|
caddy.RegisterModule(AutomateLoader{})
|
||||||
|
|
||||||
caddy.RegisterType("tls.certificates", []interface{}{
|
caddy.RegisterNamespace("tls.certificates", []interface{}{
|
||||||
(*CertificateLoader)(nil),
|
(*CertificateLoader)(nil),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
2
types.go
2
types.go
|
@ -7,7 +7,7 @@ import (
|
||||||
|
|
||||||
var namespaceTypes map[string][]reflect.Type = make(map[string][]reflect.Type)
|
var namespaceTypes map[string][]reflect.Type = make(map[string][]reflect.Type)
|
||||||
|
|
||||||
func RegisterType(namespace string, vals []interface{}) {
|
func RegisterNamespace(namespace string, vals []interface{}) {
|
||||||
var types []reflect.Type
|
var types []reflect.Type
|
||||||
for _, v := range vals {
|
for _, v := range vals {
|
||||||
reflect.TypeOf(v).Elem()
|
reflect.TypeOf(v).Elem()
|
||||||
|
|
Loading…
Reference in a new issue