Fixes tests, moves layerhandler in config file

This commit is contained in:
Brian Bland 2015-01-08 17:29:22 -08:00
parent b11d549fd0
commit 9d3436c18e
2 changed files with 8 additions and 6 deletions

View file

@ -78,10 +78,10 @@ func NewApp(configuration configuration.Configuration) *App {
app.accessController = accessController
}
layerHandlerType := configuration.HTTP.LayerHandler.Type()
layerHandlerType := configuration.LayerHandler.Type()
if layerHandlerType != "" {
lh, err := storage.GetLayerHandler(layerHandlerType, configuration.HTTP.LayerHandler.Parameters(), driver)
lh, err := storage.GetLayerHandler(layerHandlerType, configuration.LayerHandler.Parameters(), driver)
if err != nil {
panic(fmt.Sprintf("unable to configure layer handler (%s): %v", layerHandlerType, err))
}

View file

@ -58,11 +58,13 @@ func (lh *layerHandler) GetLayer(w http.ResponseWriter, r *http.Request) {
}
defer layer.Close()
handler, err := lh.layerHandler.Resolve(layer)
if lh.layerHandler != nil {
handler, _ := lh.layerHandler.Resolve(layer)
if handler != nil {
handler.ServeHTTP(w, r)
return
}
}
http.ServeContent(w, r, layer.Digest().String(), layer.CreatedAt(), layer)
}