From eb4b07840e8f0c835c43e793bd3c8b9c6cdeff34 Mon Sep 17 00:00:00 2001 From: Arzumify Date: Tue, 15 Oct 2024 18:33:45 +0100 Subject: [PATCH] Try to fix subdomains (2/2) Signed-off-by: Arzumify --- main.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index 172b43f..3868438 100644 --- a/main.go +++ b/main.go @@ -565,16 +565,17 @@ func main() { lock.Unlock() // Check if they want a subdomain - finalRouter := chi.NewRouter() + var finalRouter *chi.Mux serviceConfig, ok := config.Services[strings.ToLower(serviceInformation.Name)] if !ok { slog.Error("Service configuration not found for service: ", serviceInformation.Name) os.Exit(1) } if serviceConfig.(map[string]interface{})["subdomain"] != nil { + finalRouter = chi.NewRouter() hostRouter.Map(serviceConfig.(map[string]interface{})["subdomain"].(string), finalRouter) } else { - hostRouter.Map("", finalRouter) + finalRouter = router } slog.Info("Activating service " + serviceInformation.Name + " with ID " + serviceInformation.ServiceID.String())