enhancement: simplify ready and health check handler usage

This commit is contained in:
Florian Schade
2024-10-16 20:26:00 +02:00
parent 0ea4312668
commit 66ff86bd35
27 changed files with 207 additions and 82 deletions
+4 -3
View File
@@ -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)),
)
readinessHandler := handlers.NewCheckHandler(
handlers.NewCheckHandlerConfiguration().
WithLogger(options.Logger).
WithCheck("ldap-check", handlers.NewTCPCheck(options.Config.Ldap.URI)).
WithInheritedChecksFrom(healthHandler.Conf),
WithCheck("ldap-check", checks.NewTCPCheck(options.Config.Ldap.URI)).
WithChecks(healthHandler.Checks()),
)
return debug.NewService(