Skip to content

Commit

Permalink
take handler update
Browse files Browse the repository at this point in the history
forgot to commit this earlier

Signed-off-by: Manish Tomar <[email protected]>
  • Loading branch information
Manish Tomar committed Aug 3, 2018
1 parent 328069b commit 8f67582
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions registry/handlers/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,11 @@ type App struct {

Config *configuration.Configuration

router *mux.Router // main application router, configured with dispatchers
driver storagedriver.StorageDriver // driver maintains the app global storage driver instance.
registry distribution.Namespace // registry is the primary registry backend for the app instance.
accessController auth.AccessController // main access controller for application
router *mux.Router // main application router, configured with dispatchers
driver storagedriver.StorageDriver // driver maintains the app global storage driver instance.
registry distribution.Namespace // registry is the primary registry backend for the app instance.
repoRemover distribution.RepositoryRemover // repoRemover provides ability to delete repos
accessController auth.AccessController // main access controller for application

// httpHost is a parsed representation of the http.host parameter from
// the configuration. Only the Scheme and Host fields are used.
Expand Down Expand Up @@ -320,6 +321,11 @@ func NewApp(ctx context.Context, config *configuration.Configuration) *App {
app.isCache = true
dcontext.GetLogger(app).Info("Registry configured as a proxy cache to ", config.Proxy.RemoteURL)
}
var ok bool
app.repoRemover, ok = app.registry.(distribution.RepositoryRemover)
if !ok {
dcontext.GetLogger(app).Warnf("Registry does not implement RempositoryRemover. Will not be able to delete repos and tags")
}

return app
}
Expand Down Expand Up @@ -696,8 +702,9 @@ func (app *App) dispatcher(dispatch dispatchFunc) http.Handler {
}

// assign and decorate the authorized repository with an event bridge.
context.Repository = notifications.Listen(
context.Repository, context.App.repoRemover = notifications.Listen(
repository,
context.App.repoRemover,
app.eventBridge(context, r))

context.Repository, err = applyRepoMiddleware(app, context.Repository, app.Config.Middleware["repository"])
Expand Down

0 comments on commit 8f67582

Please sign in to comment.