Embed frontend dist into Go binary; remove frontend path from health
- New backend/embed package embeds frontend dist/ via //go:embed - Go binary serves frontend from embedded FS (no external files needed) - Dev mode uses placeholder dir (dev.txt) so Go compiles; Vite handles frontend in dev mode - Makefile copies frontend/dist/ to backend/embed/dist/ during build - Removed FRONTEND_DIR env var and filesystem serving fallback - Removed frontend path from Health API response and Status page frontend section (only Served boolean remains) - Removed frontendDir from Handler struct/constructor (unused)
This commit is contained in:
@@ -50,8 +50,7 @@ type SteamCMDHealth struct {
|
||||
}
|
||||
|
||||
type FrontendHealth struct {
|
||||
Served bool `json:"served"`
|
||||
Path string `json:"path"`
|
||||
Served bool `json:"served"`
|
||||
}
|
||||
|
||||
func (h *Handler) Health(c *gin.Context) {
|
||||
@@ -60,7 +59,6 @@ func (h *Handler) Health(c *gin.Context) {
|
||||
|
||||
paths := h.checkPaths()
|
||||
disk := h.checkDisk()
|
||||
frontendServed, _ := h.checkFrontend()
|
||||
|
||||
resp := HealthResponse{
|
||||
Server: ServerHealth{
|
||||
@@ -78,8 +76,7 @@ func (h *Handler) Health(c *gin.Context) {
|
||||
Running: h.steamcmd.IsRunning(),
|
||||
},
|
||||
Frontend: FrontendHealth{
|
||||
Served: frontendServed,
|
||||
Path: h.frontendDir,
|
||||
Served: true,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -129,14 +126,6 @@ func (h *Handler) checkDisk() []DiskHealth {
|
||||
return result
|
||||
}
|
||||
|
||||
func (h *Handler) checkFrontend() (bool, string) {
|
||||
if h.frontendDir == "" {
|
||||
return false, ""
|
||||
}
|
||||
fi, err := os.Stat(h.frontendDir)
|
||||
return err == nil && fi.IsDir(), h.frontendDir
|
||||
}
|
||||
|
||||
func checkServerBinary(serverfileDir string) bool {
|
||||
_, found := findServerBinary(serverfileDir)
|
||||
return found
|
||||
|
||||
Reference in New Issue
Block a user