the server probs added to the several services

This commit is contained in:
Roman Perekhod
2024-10-16 09:28:24 +02:00
parent 4f8d0bbd63
commit d4fe58da19
7 changed files with 67 additions and 8 deletions
@@ -2,6 +2,7 @@ package debug
import (
"net/http"
"strconv"
"github.com/owncloud/ocis/v2/ocis-pkg/handlers"
"github.com/owncloud/ocis/v2/ocis-pkg/service/debug"
@@ -17,6 +18,14 @@ func Server(opts ...Option) (*http.Server, error) {
WithLogger(options.Logger),
)
readyHandler := handlers.NewCheckHandler(
handlers.NewCheckHandlerConfiguration().
WithLogger(options.Logger).
WithCheck("nats reachability", handlers.NewNatsCheck(options.Config.Notifications.Events.Cluster)).
WithCheck("smtp-check", handlers.NewTCPCheck(options.Config.Notifications.SMTP.Host+":"+strconv.Itoa(options.Config.Notifications.SMTP.Port))).
WithInheritedChecksFrom(checkHandler.Conf),
)
return debug.NewService(
debug.Logger(options.Logger),
debug.Name(options.Config.Service.Name),
@@ -26,6 +35,6 @@ func Server(opts ...Option) (*http.Server, error) {
debug.Pprof(options.Config.Debug.Pprof),
debug.Zpages(options.Config.Debug.Zpages),
debug.Health(checkHandler),
debug.Ready(checkHandler),
debug.Ready(readyHandler),
), nil
}