Add an "enabled" parameter under "readonly", and make it as if the mutable handlers don't exist when read-only mode is enabled
Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
This commit is contained in:
parent
c9bb330b71
commit
a601f92336
8 changed files with 49 additions and 52 deletions
|
@ -32,11 +32,16 @@ func blobDispatcher(ctx *Context, r *http.Request) http.Handler {
|
|||
Digest: dgst,
|
||||
}
|
||||
|
||||
return handlers.MethodHandler{
|
||||
"GET": http.HandlerFunc(blobHandler.GetBlob),
|
||||
"HEAD": http.HandlerFunc(blobHandler.GetBlob),
|
||||
"DELETE": mutableHandler(blobHandler.DeleteBlob, ctx),
|
||||
mhandler := handlers.MethodHandler{
|
||||
"GET": http.HandlerFunc(blobHandler.GetBlob),
|
||||
"HEAD": http.HandlerFunc(blobHandler.GetBlob),
|
||||
}
|
||||
|
||||
if !ctx.readOnly {
|
||||
mhandler["DELETE"] = http.HandlerFunc(blobHandler.DeleteBlob)
|
||||
}
|
||||
|
||||
return mhandler
|
||||
}
|
||||
|
||||
// blobHandler serves http blob requests.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue