mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-01-07 21:00:30 -06:00
fix: 'readyz' enpdoint check only required service
The readyz endpoint contained unconditional checks for the LDAP and nats endpoints. Depending on configuration neihter LDAP nor NATS might be required.
This commit is contained in:
committed by
Ralf Haferkamp
parent
d1a6cc22c1
commit
b099dcdf6e
@@ -18,13 +18,23 @@ 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
|
||||
|
||||
// Check for LDAP reachability, when we're using the LDAP backend
|
||||
if options.Config.Identity.Backend == "ldap" {
|
||||
u, err := url.Parse(options.Config.Identity.LDAP.URI)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
readyHandlerConfiguration = readyHandlerConfiguration.
|
||||
WithCheck("ldap reachability", checks.NewTCPCheck(u.Host))
|
||||
}
|
||||
|
||||
// only check nats if really needed
|
||||
if options.Config.Events.Endpoint != "" {
|
||||
readyHandlerConfiguration = readyHandlerConfiguration.
|
||||
WithCheck("nats reachability", checks.NewNatsCheck(options.Config.Events.Endpoint))
|
||||
}
|
||||
readyHandlerConfiguration := healthHandlerConfiguration.
|
||||
WithCheck("nats reachability", checks.NewNatsCheck(options.Config.Events.Endpoint)).
|
||||
WithCheck("ldap reachability", checks.NewTCPCheck(u.Host))
|
||||
|
||||
return debug.NewService(
|
||||
debug.Logger(options.Logger),
|
||||
|
||||
Reference in New Issue
Block a user