mirror of
https://github.com/0xJacky/nginx-ui.git
synced 2025-05-11 02:15:48 +02:00
feat: build with no embedded front-end files
This commit is contained in:
parent
b090564a34
commit
a560d98acf
10 changed files with 91 additions and 35 deletions
29
internal/middleware/embed.go
Normal file
29
internal/middleware/embed.go
Normal file
|
@ -0,0 +1,29 @@
|
|||
//go:build !unembed
|
||||
|
||||
package middleware
|
||||
|
||||
import (
|
||||
"io/fs"
|
||||
"net/http"
|
||||
"path"
|
||||
|
||||
"github.com/0xJacky/Nginx-UI/app"
|
||||
"github.com/gin-contrib/static"
|
||||
"github.com/uozi-tech/cosy/logger"
|
||||
)
|
||||
|
||||
func MustFs(dir string) (serverFileSystem static.ServeFileSystem) {
|
||||
|
||||
sub, err := fs.Sub(app.DistFS, path.Join("dist", dir))
|
||||
|
||||
if err != nil {
|
||||
logger.Error(err)
|
||||
return
|
||||
}
|
||||
|
||||
serverFileSystem = ServerFileSystemType{
|
||||
http.FS(sub),
|
||||
}
|
||||
|
||||
return
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue