Try to fix subdomains (2/2)

Signed-off-by: Arzumify <jliwin98@danwin1210.de>
This commit is contained in:
Tracker-Friendly 2024-10-15 18:33:45 +01:00
parent c4dae7ac03
commit eb4b07840e
1 changed files with 3 additions and 2 deletions

View File

@ -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())