From 2f7e0de208df9fd77f8546c84703bb2d56c61ab3 Mon Sep 17 00:00:00 2001 From: hperl <34397+hperl@users.noreply.github.com> Date: Fri, 3 Feb 2023 13:04:06 +0100 Subject: [PATCH] feat: expose health checks in middleware --- middleware/definitions.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/middleware/definitions.go b/middleware/definitions.go index 9809499619..257f6c9b2e 100644 --- a/middleware/definitions.go +++ b/middleware/definitions.go @@ -12,10 +12,12 @@ import ( _ "github.com/ory/jsonschema/v3/fileloader" _ "github.com/ory/jsonschema/v3/httploader" "github.com/ory/x/configx" + "github.com/ory/x/healthx" "github.com/ory/x/logrusx" "github.com/ory/oathkeeper/driver" "github.com/ory/oathkeeper/driver/configuration" + "github.com/ory/oathkeeper/driver/health" "github.com/ory/oathkeeper/proxy" "github.com/ory/oathkeeper/rule" "github.com/ory/oathkeeper/x" @@ -26,6 +28,7 @@ type ( Logger() *logrusx.Logger RuleMatcher() rule.Matcher ProxyRequestHandler() proxy.RequestHandler + HealthEventManager() health.EventManager } middleware struct{ dependencies } @@ -33,6 +36,7 @@ type ( Middleware interface { UnaryInterceptor() grpc.UnaryServerInterceptor StreamInterceptor() grpc.StreamServerInterceptor + HealthxReadyCheckers() healthx.ReadyCheckers } options struct { @@ -90,3 +94,7 @@ func New(ctx context.Context, opts ...Option) (Middleware, error) { return m, nil } + +func (m *middleware) HealthxReadyCheckers() healthx.ReadyCheckers { + return m.HealthEventManager().HealthxReadyCheckers() +}