feat: configuration
/ publish (push) Successful in 3m27s

This commit is contained in:
2026-03-07 16:58:19 +01:00
parent 4efd3ee396
commit f5bcc7c381
20 changed files with 157 additions and 27 deletions
+22 -6
View File
@@ -1,22 +1,38 @@
package main
import (
"context"
"log/slog"
"os"
"os/signal"
"git.schreifuchs.ch/schreifuchs/schreifuchs.ch/internal/pkg/config"
"git.schreifuchs.ch/schreifuchs/schreifuchs.ch/internal/server"
)
func main() {
server := server.NewServer()
ctx := context.Background()
ctx, cancle := context.WithCancel(ctx)
defer cancle()
go func() {
sigint := make(chan os.Signal, 1)
signal.Notify(sigint, os.Interrupt)
<-sigint
cancle()
}()
slog.SetLogLoggerLevel(slog.LevelDebug)
slog.Info("Server started", "addr", server.Addr)
err := server.ListenAndServe()
cfg, err := config.Read(ctx)
if err != nil {
slog.Error("Server failed to start", "error", err)
os.Exit(1)
slog.Error("could not read configuaration", "err", err)
}
err = server.Start(ctx, cfg)
if err != nil {
slog.Error("error while serving", "err", err)
return
}
}