forked from TrueCloudLab/distribution
Add a read-only mode as a configuration option
Add "readonly" under the storage/maintenance section. When this is set to true, uploads and deletions will return 503 Service Unavailable errors. Document the parameter and add some unit testing. Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
This commit is contained in:
parent
5a8fabfee3
commit
df9758ba39
7 changed files with 92 additions and 12 deletions
|
@ -23,12 +23,12 @@ func blobUploadDispatcher(ctx *Context, r *http.Request) http.Handler {
|
|||
}
|
||||
|
||||
handler := http.Handler(handlers.MethodHandler{
|
||||
"POST": http.HandlerFunc(buh.StartBlobUpload),
|
||||
"POST": mutableHandler(buh.StartBlobUpload, ctx),
|
||||
"GET": http.HandlerFunc(buh.GetUploadStatus),
|
||||
"HEAD": http.HandlerFunc(buh.GetUploadStatus),
|
||||
"PATCH": http.HandlerFunc(buh.PatchBlobData),
|
||||
"PUT": http.HandlerFunc(buh.PutBlobUploadComplete),
|
||||
"DELETE": http.HandlerFunc(buh.CancelBlobUpload),
|
||||
"PATCH": mutableHandler(buh.PatchBlobData, ctx),
|
||||
"PUT": mutableHandler(buh.PutBlobUploadComplete, ctx),
|
||||
"DELETE": mutableHandler(buh.CancelBlobUpload, ctx),
|
||||
})
|
||||
|
||||
if buh.UUID != "" {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue