Added static serving
This commit is contained in:
+14
-1
@@ -1,6 +1,8 @@
|
||||
package routes
|
||||
|
||||
import (
|
||||
"log"
|
||||
"path/filepath"
|
||||
"quay/app/handlers"
|
||||
"quay/internal/config"
|
||||
|
||||
@@ -9,6 +11,17 @@ import (
|
||||
|
||||
func Register(app *fiber.App, cfg *config.Config) {
|
||||
api := app.Group("/api")
|
||||
|
||||
api.Get("/health", handlers.HealthCheck)
|
||||
|
||||
storagePath, err := filepath.Abs(cfg.Global.StoragePath)
|
||||
if err != nil {
|
||||
log.Fatalf("Failed to resolve storage path: %v", err)
|
||||
}
|
||||
|
||||
siteMap := make(map[string]config.SiteConfig)
|
||||
for _, site := range cfg.Sites {
|
||||
siteMap[site.Domain] = site
|
||||
}
|
||||
|
||||
app.Use(handlers.NewStaticHandler(storagePath, siteMap))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user