Try to fix subdomains (2/2)
Signed-off-by: Arzumify <jliwin98@danwin1210.de>
This commit is contained in:
parent
c4dae7ac03
commit
eb4b07840e
5
main.go
5
main.go
|
@ -565,16 +565,17 @@ func main() {
|
||||||
lock.Unlock()
|
lock.Unlock()
|
||||||
|
|
||||||
// Check if they want a subdomain
|
// Check if they want a subdomain
|
||||||
finalRouter := chi.NewRouter()
|
var finalRouter *chi.Mux
|
||||||
serviceConfig, ok := config.Services[strings.ToLower(serviceInformation.Name)]
|
serviceConfig, ok := config.Services[strings.ToLower(serviceInformation.Name)]
|
||||||
if !ok {
|
if !ok {
|
||||||
slog.Error("Service configuration not found for service: ", serviceInformation.Name)
|
slog.Error("Service configuration not found for service: ", serviceInformation.Name)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
if serviceConfig.(map[string]interface{})["subdomain"] != nil {
|
if serviceConfig.(map[string]interface{})["subdomain"] != nil {
|
||||||
|
finalRouter = chi.NewRouter()
|
||||||
hostRouter.Map(serviceConfig.(map[string]interface{})["subdomain"].(string), finalRouter)
|
hostRouter.Map(serviceConfig.(map[string]interface{})["subdomain"].(string), finalRouter)
|
||||||
} else {
|
} else {
|
||||||
hostRouter.Map("", finalRouter)
|
finalRouter = router
|
||||||
}
|
}
|
||||||
|
|
||||||
slog.Info("Activating service " + serviceInformation.Name + " with ID " + serviceInformation.ServiceID.String())
|
slog.Info("Activating service " + serviceInformation.Name + " with ID " + serviceInformation.ServiceID.String())
|
||||||
|
|
Loading…
Reference in New Issue