forked from TrueCloudLab/distribution
take handler update
forgot to commit this earlier Signed-off-by: Manish Tomar <manish.tomar@docker.com>
This commit is contained in:
parent
328069bb4d
commit
8f6758278d
1 changed files with 12 additions and 5 deletions
|
@ -61,6 +61,7 @@ type App struct {
|
||||||
router *mux.Router // main application router, configured with dispatchers
|
router *mux.Router // main application router, configured with dispatchers
|
||||||
driver storagedriver.StorageDriver // driver maintains the app global storage driver instance.
|
driver storagedriver.StorageDriver // driver maintains the app global storage driver instance.
|
||||||
registry distribution.Namespace // registry is the primary registry backend for the app 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
|
accessController auth.AccessController // main access controller for application
|
||||||
|
|
||||||
// httpHost is a parsed representation of the http.host parameter from
|
// httpHost is a parsed representation of the http.host parameter from
|
||||||
|
@ -320,6 +321,11 @@ func NewApp(ctx context.Context, config *configuration.Configuration) *App {
|
||||||
app.isCache = true
|
app.isCache = true
|
||||||
dcontext.GetLogger(app).Info("Registry configured as a proxy cache to ", config.Proxy.RemoteURL)
|
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
|
return app
|
||||||
}
|
}
|
||||||
|
@ -696,8 +702,9 @@ func (app *App) dispatcher(dispatch dispatchFunc) http.Handler {
|
||||||
}
|
}
|
||||||
|
|
||||||
// assign and decorate the authorized repository with an event bridge.
|
// assign and decorate the authorized repository with an event bridge.
|
||||||
context.Repository = notifications.Listen(
|
context.Repository, context.App.repoRemover = notifications.Listen(
|
||||||
repository,
|
repository,
|
||||||
|
context.App.repoRemover,
|
||||||
app.eventBridge(context, r))
|
app.eventBridge(context, r))
|
||||||
|
|
||||||
context.Repository, err = applyRepoMiddleware(app, context.Repository, app.Config.Middleware["repository"])
|
context.Repository, err = applyRepoMiddleware(app, context.Repository, app.Config.Middleware["repository"])
|
||||||
|
|
Loading…
Reference in a new issue