feat: add api, checker and statuspage entrypoints
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
This commit is contained in:
1 parent
8ea459e5f1
commit
3b3879d9b5
3 files changed
+164
No files matched your search
@@ -0,0 +1,41 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"git.zb-server.de/ZB-Server/uptimesebi/internal/config"
|
||||
"git.zb-server.de/ZB-Server/uptimesebi/internal/platform"
|
||||
"git.zb-server.de/ZB-Server/uptimesebi/internal/web"
|
||||
)
|
||||
|
||||
func main() {
|
||||
if err := run(); err != nil {
|
||||
fmt.Fprintln(os.Stderr, err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
func run() error {
|
||||
cfg, err := config.Load[config.StatusPage]()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
ctx, stop := platform.SignalContext()
|
||||
defer stop()
|
||||
|
||||
log := platform.NewLogger(cfg.Common, "statuspage")
|
||||
deps, err := platform.Connect(ctx, cfg.Common, log)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer deps.Close()
|
||||
|
||||
health := platform.NewHealth(deps.Probes())
|
||||
r := platform.NewRouter()
|
||||
health.Register(r)
|
||||
r.StaticFS("/static", web.Static())
|
||||
|
||||
return platform.Serve(ctx, log, platform.NewHTTPServer(cfg.Listen, r), health, 5*time.Second, cfg.ShutdownTimeout)
|
||||
}
|
||||
Reference in new issue
Block a user