forked from TrueCloudLab/distribution
Fixes tests, moves layerhandler in config file
This commit is contained in:
parent
b11d549fd0
commit
9d3436c18e
2 changed files with 8 additions and 6 deletions
|
@ -78,10 +78,10 @@ func NewApp(configuration configuration.Configuration) *App {
|
||||||
app.accessController = accessController
|
app.accessController = accessController
|
||||||
}
|
}
|
||||||
|
|
||||||
layerHandlerType := configuration.HTTP.LayerHandler.Type()
|
layerHandlerType := configuration.LayerHandler.Type()
|
||||||
|
|
||||||
if layerHandlerType != "" {
|
if layerHandlerType != "" {
|
||||||
lh, err := storage.GetLayerHandler(layerHandlerType, configuration.HTTP.LayerHandler.Parameters(), driver)
|
lh, err := storage.GetLayerHandler(layerHandlerType, configuration.LayerHandler.Parameters(), driver)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(fmt.Sprintf("unable to configure layer handler (%s): %v", layerHandlerType, err))
|
panic(fmt.Sprintf("unable to configure layer handler (%s): %v", layerHandlerType, err))
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,10 +58,12 @@ func (lh *layerHandler) GetLayer(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
defer layer.Close()
|
defer layer.Close()
|
||||||
|
|
||||||
handler, err := lh.layerHandler.Resolve(layer)
|
if lh.layerHandler != nil {
|
||||||
if handler != nil {
|
handler, _ := lh.layerHandler.Resolve(layer)
|
||||||
handler.ServeHTTP(w, r)
|
if handler != nil {
|
||||||
return
|
handler.ServeHTTP(w, r)
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
http.ServeContent(w, r, layer.Digest().String(), layer.CreatedAt(), layer)
|
http.ServeContent(w, r, layer.Digest().String(), layer.CreatedAt(), layer)
|
||||||
|
|
Loading…
Reference in a new issue