Skip to content

Commit 166c4a9

Browse files
committed
Pass in app as context to apply{N}Middleware
This lets us access registry config within middleware for additional configuration of whatever it is that you're overriding. Signed-off-by: Tony Holdstock-Brown <[email protected]>
1 parent 5bbf654 commit 166c4a9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

registry/handlers/app.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ func NewApp(ctx context.Context, config *configuration.Configuration) *App {
258258
}
259259
}
260260

261-
app.registry, err = applyRegistryMiddleware(app.Context, app.registry, config.Middleware["registry"])
261+
app.registry, err = applyRegistryMiddleware(app, app.registry, config.Middleware["registry"])
262262
if err != nil {
263263
panic(err)
264264
}
@@ -647,7 +647,7 @@ func (app *App) dispatcher(dispatch dispatchFunc) http.Handler {
647647
repository,
648648
app.eventBridge(context, r))
649649

650-
context.Repository, err = applyRepoMiddleware(context.Context, context.Repository, app.Config.Middleware["repository"])
650+
context.Repository, err = applyRepoMiddleware(app, context.Repository, app.Config.Middleware["repository"])
651651
if err != nil {
652652
ctxu.GetLogger(context).Errorf("error initializing repository middleware: %v", err)
653653
context.Errors = append(context.Errors, errcode.ErrorCodeUnknown.WithDetail(err))

0 commit comments

Comments
 (0)