update echo to v5 and prepare kontor-echo to use handlers, repository and service
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 3s
Gitea Actions Demo / build-and-test (push) Failing after 11s

This commit is contained in:
Thomas Peetz
2026-11-05 20:33:46 +01:00
parent 20e141b73e
commit 9a7219e106
5 changed files with 145 additions and 35 deletions
+39
View File
@@ -0,0 +1,39 @@
package main
import (
"context"
"net/http"
"os"
"os/signal"
"syscall"
"time"
"log"
"log/slog"
echojwt "github.com/labstack/echo-jwt/v4"
"github.com/labstack/echo/v4"
"github.com/labstack/echo/v4/middleware"
)
func main() {
slog.Info("Kontor started")
db, err := schema.GetDatabase()
if err := config.InitConfig(); err != nil {
log.Fatalf("Failed to initialize config: %v", err)
}
e := router.New(handlers.NewAdminHandler(db, config.ServerConfig.ApiSecret), handlers.NewMediaHandler(db))
// Cancel the context on SIGINT / SIGTERM
ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM)
defer stop()
sc := echo.StartConfig{
Address: ":1323",
GracefulTimeout: 10 * time.Second,
}
if err := sc.Start(ctx, e); err != nil {
e.Logger.Error("server stopped", "error", err)
}
slog.Info("Kontor finished")
}