update kontor-echo
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 9s
Gitea Actions Demo / build-and-test (push) Failing after 14s

This commit is contained in:
Thomas Peetz
2026-11-06 16:48:15 +01:00
parent 9a7219e106
commit 50e2da8a66
40 changed files with 2966 additions and 289 deletions
+23 -20
View File
@@ -1,39 +1,42 @@
package main
import (
"context"
"net/http"
"os"
"os/signal"
"syscall"
"time"
"context"
"kontor-api-echo/internal/config"
"kontor-api-echo/internal/handlers"
"kontor-api-echo/internal/router"
"kontor-api-echo/pkg/schema"
"log"
"log/slog"
echojwt "github.com/labstack/echo-jwt/v4"
"github.com/labstack/echo/v4"
"github.com/labstack/echo/v4/middleware"
"os"
"os/signal"
"syscall"
"time"
"github.com/labstack/echo/v5"
)
func main() {
slog.Info("Kontor started")
db, err := schema.GetDatabase()
db, _ := 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()
// 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)
}
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")
}