Request access logs, panics, migration output and fatal errors are now emitted through the JSON slog handler. BREAKING CHANGE: UPTIME_LOG_FORMAT is removed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
41 lines
854 B
Go
41 lines
854 B
Go
package main
|
|
|
|
import (
|
|
"log/slog"
|
|
"os"
|
|
|
|
"git.zb-server.de/ZB-Server/uptimesebi/internal/config"
|
|
"git.zb-server.de/ZB-Server/uptimesebi/internal/platform"
|
|
)
|
|
|
|
func main() {
|
|
log := platform.NewLogger("checker")
|
|
if err := run(log); err != nil {
|
|
log.Error("exit", "error", err)
|
|
os.Exit(1)
|
|
}
|
|
}
|
|
|
|
func run(log *slog.Logger) error {
|
|
cfg, err := config.Load[config.Checker]()
|
|
if err != nil {
|
|
return err
|
|
}
|
|
platform.SetLogLevel(cfg.LogLevel)
|
|
ctx, stop := platform.SignalContext()
|
|
defer stop()
|
|
|
|
log = log.With("region", cfg.Region)
|
|
deps, err := platform.Connect(ctx, cfg.Common, log)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
defer deps.Close()
|
|
|
|
health := platform.NewHealth(deps.Probes())
|
|
r := platform.NewRouter(log)
|
|
health.Register(r)
|
|
|
|
return platform.Serve(ctx, log, platform.NewHTTPServer(cfg.HealthListen, r), health, 0, cfg.ShutdownTimeout)
|
|
}
|