Added config setting to disable site

This commit is contained in:
2026-03-31 13:56:13 +02:00
parent dcc8201099
commit e4b9c36486
3 changed files with 10 additions and 4 deletions
+4 -2
View File
@@ -1,7 +1,6 @@
package handlers
import (
"log"
"os"
"path/filepath"
"quay/internal/config"
@@ -16,6 +15,10 @@ func NewStaticHandler(storagePath string, siteMap map[string]config.SiteConfig)
return c.Status(fiber.StatusNotFound).SendString("Site not found")
}
if !site.Enabled {
return c.Status(fiber.StatusServiceUnavailable).SendString("Site is currently unavailable")
}
urlPath := filepath.Clean(c.Path())
for _, rule := range site.ForwardRules {
@@ -23,7 +26,6 @@ func NewStaticHandler(storagePath string, siteMap map[string]config.SiteConfig)
match := rule.Compiled.FindStringSubmatchIndex(urlPath)
if match != nil {
dest := rule.Compiled.ExpandString([]byte{}, rule.Destination, urlPath, match)
log.Printf("Forwarding %s to %s based on regex rule", urlPath, dest)
return c.Redirect().Status(rule.StatusCode).To(string(dest))
}
} else if rule.Source == urlPath {