From b1fc715ec9be3eb663e67de8f4ab84b7437284a4 Mon Sep 17 00:00:00 2001 From: henrygd Date: Thu, 6 Mar 2025 05:38:33 -0500 Subject: [PATCH] fix: prevent 404 on initial startup by moving h.initialize after hooks - I don't know why this works. Need to look further into it tomorrow :) --- beszel/internal/hub/hub.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/beszel/internal/hub/hub.go b/beszel/internal/hub/hub.go index 8ca9f98..ee7d147 100644 --- a/beszel/internal/hub/hub.go +++ b/beszel/internal/hub/hub.go @@ -64,11 +64,6 @@ func (h *Hub) BootstrapHub() (*Hub, error) { } } - // initial setup - if err := h.initialize(); err != nil { - return nil, err - } - // serve web ui h.OnServe().BindFunc(h.startServer) // set up scheduled jobs @@ -85,6 +80,11 @@ func (h *Hub) BootstrapHub() (*Hub, error) { // start system updates h.sm.Initialize() + // initial setup + if err := h.initialize(); err != nil { + return nil, err + } + return h, nil } @@ -145,7 +145,6 @@ func (h *Hub) initialize() error { // Start starts the hub application / server func (h *Hub) Start() error { - // Use type assertion to access the Start method if pb, ok := h.App.(*pocketbase.PocketBase); ok { return pb.Start() }