Embed web assets into the Go binary
Serve /static from embedded assets when no static path override is configured, add static route coverage, and update Docker/docs to reflect embedded-by-default behavior. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
package webterm
|
||||
|
||||
import (
|
||||
"embed"
|
||||
"io/fs"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
//go:embed static static/* static/js/* static/icons/*
|
||||
var embeddedStaticAssets embed.FS
|
||||
|
||||
func embeddedStaticFS() (http.FileSystem, bool) {
|
||||
sub, err := fs.Sub(embeddedStaticAssets, "static")
|
||||
if err != nil {
|
||||
return nil, false
|
||||
}
|
||||
return http.FS(sub), true
|
||||
}
|
||||
Reference in New Issue
Block a user