feat: migrations
This commit is contained in:
@ -1,17 +1,23 @@
|
||||
package client
|
||||
|
||||
import (
|
||||
"embed"
|
||||
"io/fs"
|
||||
"net/http"
|
||||
|
||||
"github.com/spotdemo4/trevstack/server/internal/interceptors"
|
||||
)
|
||||
|
||||
var embedfs *http.FileSystem
|
||||
|
||||
func NewClientHandler(key string) http.Handler {
|
||||
if embedfs != nil {
|
||||
return interceptors.WithAuthRedirect(http.FileServer(*embedfs), key)
|
||||
func NewClientHandler(key string, clientFS *embed.FS) http.Handler {
|
||||
if clientFS == nil {
|
||||
return http.NotFoundHandler()
|
||||
}
|
||||
|
||||
return http.NotFoundHandler()
|
||||
client, err := fs.Sub(clientFS, "client")
|
||||
if err != nil {
|
||||
return http.NotFoundHandler()
|
||||
}
|
||||
|
||||
fs := http.FS(client)
|
||||
return interceptors.WithAuthRedirect(http.FileServer(fs), key)
|
||||
}
|
||||
|
Reference in New Issue
Block a user