From acd10d45e8d5897640d21c2fabb662a498f22cce Mon Sep 17 00:00:00 2001 From: Jonas Kaninda Date: Mon, 18 Nov 2024 13:06:35 +0100 Subject: [PATCH] chore: add route config check --- internal/check_config.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/internal/check_config.go b/internal/check_config.go index bfc44fb..176ec99 100644 --- a/internal/check_config.go +++ b/internal/check_config.go @@ -56,7 +56,7 @@ func CheckConfig(fileName string) error { } } fmt.Println("Checking middlewares...done") - //Check additional routes + // Check additional routes fmt.Println("Checking routes...") // Load Extra Routes if len(gateway.gateway.ExtraRoutes.Directory) != 0 { @@ -90,7 +90,7 @@ func checkRoutes(routes []Route, middlewares []Middleware) { if route.Destination == "" && len(route.Backends) == 0 { fmt.Printf("Error: no destination or backends specified for route: %s | index: [%d] \n", route.Name, index) } - //checking middleware applied to routes + // checking middleware applied to routes for _, middleware := range route.Middlewares { if !slices.Contains(midNames, middleware) { fmt.Printf("Couldn't find a middleware with the name: %s | route: %s \n", middleware, route.Name) @@ -107,9 +107,7 @@ func checkRoutes(routes []Route, middlewares []Middleware) { } func middlewareNames(middlewares []Middleware) []string { - - var names []string - + names := []string{} for _, mid := range middlewares { names = append(names, mid.Name)