refactor: migrate from rice to embed.FS

This commit is contained in:
Oleg Lobanov
2021-03-09 18:59:19 +01:00
parent 0fe34ad224
commit fc5506179a
10 changed files with 42 additions and 140 deletions

View File

@@ -3,6 +3,7 @@ package cmd
import (
"crypto/tls"
"errors"
"io/fs"
"io/ioutil"
"log"
"net"
@@ -22,6 +23,7 @@ import (
"github.com/filebrowser/filebrowser/v2/auth"
"github.com/filebrowser/filebrowser/v2/diskcache"
"github.com/filebrowser/filebrowser/v2/frontend"
fbhttp "github.com/filebrowser/filebrowser/v2/http"
"github.com/filebrowser/filebrowser/v2/img"
"github.com/filebrowser/filebrowser/v2/settings"
@@ -168,7 +170,12 @@ user created with the credentials from options "username" and "password".`,
signal.Notify(sigc, os.Interrupt, syscall.SIGTERM)
go cleanupHandler(listener, sigc)
handler, err := fbhttp.NewHandler(imgSvc, fileCache, d.store, server)
assetsFs, err := fs.Sub(frontend.Assets(), "dist")
if err != nil {
panic(err)
}
handler, err := fbhttp.NewHandler(imgSvc, fileCache, d.store, server, assetsFs)
checkErr(err)
defer listener.Close()