Merge pull request #10323 from fschade/refine-ready-health-checker

enhancement: simplify ready and health check handler usage
This commit is contained in:
Christian Richter
2024-10-17 08:28:54 +00:00
committed by GitHub
27 changed files with 212 additions and 83 deletions
@@ -3,6 +3,7 @@ package debug
import (
"net/http"
"github.com/owncloud/ocis/v2/ocis-pkg/checks"
"github.com/owncloud/ocis/v2/ocis-pkg/handlers"
"github.com/owncloud/ocis/v2/ocis-pkg/service/debug"
"github.com/owncloud/ocis/v2/ocis-pkg/version"
@@ -15,14 +16,14 @@ func Server(opts ...Option) (*http.Server, error) {
healthHandler := handlers.NewCheckHandler(
handlers.NewCheckHandlerConfiguration().
WithLogger(options.Logger).
WithCheck("http reachability", handlers.NewHTTPCheck(options.Config.HTTP.Addr)),
WithCheck("http reachability", checks.NewHTTPCheck(options.Config.HTTP.Addr)),
)
readyHandler := handlers.NewCheckHandler(
handlers.NewCheckHandlerConfiguration().
WithLogger(options.Logger).
WithCheck("nats reachability", handlers.NewNatsCheck(options.Config.Events.Cluster)).
WithInheritedChecksFrom(healthHandler.Conf),
WithCheck("nats reachability", checks.NewNatsCheck(options.Config.Events.Cluster)).
WithChecks(healthHandler.Checks()),
)
return debug.NewService(