From cf916b8a2ca9f52d5c232a53bc008bce58e68253 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Friedrich=20Dreyer?= Date: Mon, 14 Jul 2025 13:56:00 +0200 Subject: [PATCH] fix ready checks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jörn Friedrich Dreyer --- services/antivirus/pkg/server/debug/server.go | 7 ++++++- services/graph/pkg/server/debug/server.go | 7 ++++++- services/idp/pkg/server/debug/server.go | 7 ++++++- services/search/pkg/server/debug/server.go | 7 ++++++- 4 files changed, 24 insertions(+), 4 deletions(-) diff --git a/services/antivirus/pkg/server/debug/server.go b/services/antivirus/pkg/server/debug/server.go index a1d84107b..7916f6f88 100644 --- a/services/antivirus/pkg/server/debug/server.go +++ b/services/antivirus/pkg/server/debug/server.go @@ -4,6 +4,7 @@ import ( "context" "errors" "net/http" + "net/url" "github.com/dutchcoders/go-clamd" @@ -28,7 +29,11 @@ func Server(opts ...Option) (*http.Server, error) { case "clamav": return clamd.NewClamd(cfg.Scanner.ClamAV.Socket).Ping() case "icap": - return checks.NewTCPCheck(cfg.Scanner.ICAP.URL)(ctx) + u, err := url.Parse(cfg.Scanner.ICAP.URL) + if err != nil { + return err + } + return checks.NewTCPCheck(u.Host)(ctx) } }) diff --git a/services/graph/pkg/server/debug/server.go b/services/graph/pkg/server/debug/server.go index f6ec9cc9d..3f9c52e83 100644 --- a/services/graph/pkg/server/debug/server.go +++ b/services/graph/pkg/server/debug/server.go @@ -2,6 +2,7 @@ package debug import ( "net/http" + "net/url" "github.com/opencloud-eu/opencloud/pkg/checks" "github.com/opencloud-eu/opencloud/pkg/handlers" @@ -17,9 +18,13 @@ func Server(opts ...Option) (*http.Server, error) { WithLogger(options.Logger). WithCheck("web reachability", checks.NewHTTPCheck(options.Config.HTTP.Addr)) + u, err := url.Parse(options.Config.Identity.LDAP.URI) + if err != nil { + return nil, err + } readyHandlerConfiguration := healthHandlerConfiguration. WithCheck("nats reachability", checks.NewNatsCheck(options.Config.Events.Endpoint)). - WithCheck("ldap reachability", checks.NewTCPCheck(options.Config.Identity.LDAP.URI)) + WithCheck("ldap reachability", checks.NewTCPCheck(u.Host)) return debug.NewService( debug.Logger(options.Logger), diff --git a/services/idp/pkg/server/debug/server.go b/services/idp/pkg/server/debug/server.go index be95d4600..da95c6531 100644 --- a/services/idp/pkg/server/debug/server.go +++ b/services/idp/pkg/server/debug/server.go @@ -2,6 +2,7 @@ package debug import ( "net/http" + "net/url" "github.com/opencloud-eu/opencloud/pkg/checks" "github.com/opencloud-eu/opencloud/pkg/handlers" @@ -17,8 +18,12 @@ func Server(opts ...Option) (*http.Server, error) { WithLogger(options.Logger). WithCheck("http reachability", checks.NewHTTPCheck(options.Config.HTTP.Addr)) + u, err := url.Parse(options.Config.Ldap.URI) + if err != nil { + return nil, err + } readyHandlerConfiguration := healthHandlerConfiguration. - WithCheck("ldap reachability", checks.NewTCPCheck(options.Config.Ldap.URI)) + WithCheck("ldap reachability", checks.NewTCPCheck(u.Host)) return debug.NewService( debug.Logger(options.Logger), diff --git a/services/search/pkg/server/debug/server.go b/services/search/pkg/server/debug/server.go index 8241dafe9..49d087cf5 100644 --- a/services/search/pkg/server/debug/server.go +++ b/services/search/pkg/server/debug/server.go @@ -3,6 +3,7 @@ package debug import ( "context" "net/http" + "net/url" "github.com/opencloud-eu/opencloud/pkg/checks" "github.com/opencloud-eu/opencloud/pkg/handlers" @@ -22,7 +23,11 @@ func Server(opts ...Option) (*http.Server, error) { WithCheck("nats reachability", checks.NewNatsCheck(options.Config.Events.Endpoint)). WithCheck("tika-check", func(ctx context.Context) error { if options.Config.Extractor.Type == "tika" { - return checks.NewTCPCheck(options.Config.Extractor.Tika.TikaURL)(ctx) + u, err := url.Parse(options.Config.Extractor.Tika.TikaURL) + if err != nil { + return err + } + return checks.NewTCPCheck(u.Host)(ctx) } return nil })