Documentation
¶
Overview ¶
Package platform provides logging, health endpoints, middleware and the HTTP server lifecycle.
Index ¶
- Constants
- func NewLogger(level slog.Level) *slog.Logger
- func OKHandler() http.Handler
- func ReadyHandler(ping func(context.Context) error) http.Handler
- func Recover(log *slog.Logger, next http.Handler) http.Handler
- func Serve(ctx context.Context, log *slog.Logger, addr string, h http.Handler, ...) error
Constants ¶
View Source
const ( PathLive = "/.well-known/live" PathReady = "/.well-known/ready" )
Paths of the liveness and readiness probes. They are served on the same address as the WebSocket. A reverse proxy in front of the server should not expose them.
Variables ¶
This section is empty.
Functions ¶
func ReadyHandler ¶
ReadyHandler returns 200 if ping succeeds within one second, and 503 otherwise. It serves the readiness probe.
func Serve ¶
func Serve(ctx context.Context, log *slog.Logger, addr string, h http.Handler, onShutdown func(context.Context) error) error
Serve runs the HTTP server until ctx is canceled and then shuts it down within shutdownTimeout. http.Server.Shutdown does not wait for hijacked connections such as WebSockets. onShutdown closes them.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.