fix ready checks

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
This commit is contained in:
Jörn Friedrich Dreyer
2025-07-14 13:56:00 +02:00
parent 88cf2d8955
commit cf916b8a2c
4 changed files with 24 additions and 4 deletions

View File

@@ -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)
}
})

View File

@@ -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),

View File

@@ -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),

View File

@@ -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
})