mirror of
https://github.com/linka-cloud/grpc.git
synced 2024-12-23 09:20:46 +00:00
react: use fs.FS instead of embed.FS
Signed-off-by: Adphi <philippe.adrien.nousse@gmail.com>
This commit is contained in:
parent
926af303e8
commit
8f75b6aca4
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user