fileserver: Use new ServeMux
Fileserver should use its own ServeMux. Signed-off-by: Sunny <darkowlzz@protonmail.com>
This commit is contained in:
parent
04d87b61ca
commit
d0097c2e54
5
main.go
5
main.go
|
@ -345,8 +345,9 @@ func main() {
|
||||||
func startFileServer(path string, address string, l logr.Logger) {
|
func startFileServer(path string, address string, l logr.Logger) {
|
||||||
l.Info("starting file server")
|
l.Info("starting file server")
|
||||||
fs := http.FileServer(http.Dir(path))
|
fs := http.FileServer(http.Dir(path))
|
||||||
http.Handle("/", fs)
|
mux := http.NewServeMux()
|
||||||
err := http.ListenAndServe(address, nil)
|
mux.Handle("/", fs)
|
||||||
|
err := http.ListenAndServe(address, mux)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
l.Error(err, "file server error")
|
l.Error(err, "file server error")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue