own the usage of reflection into the RegisterType

allowing the users to only pass instances of the interfaces
This commit is contained in:
Mohammed Al Sahaf
2022-06-14 20:51:58 +03:00
parent 52f43d2f4c
commit b825a10927
16 changed files with 50 additions and 61 deletions
+2 -3
View File
@@ -26,7 +26,6 @@ import (
"os"
"path"
"path/filepath"
"reflect"
"runtime"
"strconv"
"strings"
@@ -42,8 +41,8 @@ import (
func init() {
weakrand.Seed(time.Now().UnixNano())
caddy.RegisterType("http.precompressed", []reflect.Type{
reflect.TypeOf((*encode.Precompressed)(nil)).Elem(),
caddy.RegisterType("http.precompressed", []interface{}{
(*encode.Precompressed)(nil),
})
caddy.RegisterModule(FileServer{})