react: use fs.FS instead of embed.FS

Signed-off-by: Adphi <philippe.adrien.nousse@gmail.com>
This commit is contained in:
Adphi 2023-01-20 14:33:52 +01:00
parent 926af303e8
commit 8f75b6aca4
Signed by: adphi
GPG Key ID: 46BE4062DB2397FF

View File

@ -15,7 +15,6 @@
package react
import (
"embed"
"io/fs"
"net/http"
"net/http/httputil"
@ -28,14 +27,14 @@ const (
EndpointEnv = "REACT_ENDPOINT"
)
func NewHandler(dir embed.FS, subpath string) (http.Handler, error) {
func NewHandler(dir fs.FS, subpath string) (http.Handler, error) {
if e := os.Getenv(EndpointEnv); e != "" {
return newProxy(e)
}
return newStatic(dir, subpath)
}
func newStatic(dir embed.FS, subpath string) (http.Handler, error) {
func newStatic(dir fs.FS, subpath string) (http.Handler, error) {
s, err := fs.Sub(dir, subpath)
if err != nil {
return nil, err