chore: add go config and logging layer

This commit is contained in:
Philipp
2026-06-10 14:56:03 +02:00
parent e4bfc62c18
commit 2112821f79
12 changed files with 265 additions and 30 deletions
+12 -3
View File
@@ -2,18 +2,27 @@ package main
import (
"context"
"log/slog"
"os"
"os/signal"
"syscall"
"forgejo.digital-droplets.de/philschlo/proxui/platform/config"
"forgejo.digital-droplets.de/philschlo/proxui/platform/logging"
)
func main() {
logger := slog.New(slog.NewJSONHandler(os.Stdout, nil))
cfg, err := config.Load()
if err != nil {
logger := logging.New("worker", "unknown", 0)
logger.Error("failed to load config", "error", err)
os.Exit(1)
}
logger := logging.New("worker", cfg.AppEnv, cfg.LogLevel)
ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM)
defer stop()
logger.Info("worker started")
logger.Info("worker started", "concurrency", cfg.WorkerConcurrency)
<-ctx.Done()
logger.Info("worker stopped")
}