Bugfix: Fix health and ready endpoint checker configurations

This commit is contained in:
Florian Schade
2024-10-17 14:34:04 +02:00
parent 08b33627b2
commit 0437722353
36 changed files with 121 additions and 357 deletions
+7 -13
View File
@@ -13,18 +13,12 @@ import (
func Server(opts ...Option) (*http.Server, error) {
options := newOptions(opts...)
healthHandler := handlers.NewCheckHandler(
handlers.NewCheckHandlerConfiguration().
WithLogger(options.Logger).
WithCheck("http reachability", checks.NewHTTPCheck(options.Config.HTTP.Addr)),
)
healthHandlerConfiguration := handlers.NewCheckHandlerConfiguration().
WithLogger(options.Logger).
WithCheck("http reachability", checks.NewHTTPCheck(options.Config.HTTP.Addr))
readinessHandler := handlers.NewCheckHandler(
handlers.NewCheckHandlerConfiguration().
WithLogger(options.Logger).
WithCheck("ldap-check", checks.NewTCPCheck(options.Config.Ldap.URI)).
WithChecks(healthHandler.Checks()),
)
readyHandlerConfiguration := healthHandlerConfiguration.
WithCheck("ldap-check", checks.NewTCPCheck(options.Config.Ldap.URI))
return debug.NewService(
debug.Logger(options.Logger),
@@ -34,7 +28,7 @@ func Server(opts ...Option) (*http.Server, error) {
debug.Token(options.Config.Debug.Token),
debug.Pprof(options.Config.Debug.Pprof),
debug.Zpages(options.Config.Debug.Zpages),
debug.Health(healthHandler),
debug.Ready(readinessHandler),
debug.Health(handlers.NewCheckHandler(healthHandlerConfiguration)),
debug.Ready(handlers.NewCheckHandler(readyHandlerConfiguration)),
), nil
}