Move registry package into handler package
The goal is to free up the distribution/registry package to include common registry types. This moves the webapp definitions out of the way to allow for this change in the future. Signed-off-by: Stephen J Day <stephen.day@docker.com>master
							parent
							
								
									90c2e4b460
								
							
						
					
					
						commit
						0f08b6961a
					
				|  | @ -14,12 +14,12 @@ import ( | ||||||
| 	_ "github.com/docker/distribution/auth/token" | 	_ "github.com/docker/distribution/auth/token" | ||||||
| 	"github.com/docker/distribution/configuration" | 	"github.com/docker/distribution/configuration" | ||||||
| 	ctxu "github.com/docker/distribution/context" | 	ctxu "github.com/docker/distribution/context" | ||||||
| 	"github.com/docker/distribution/registry" | 	"github.com/docker/distribution/registry/handlers" | ||||||
| 	_ "github.com/docker/distribution/storagedriver/filesystem" | 	_ "github.com/docker/distribution/storagedriver/filesystem" | ||||||
| 	_ "github.com/docker/distribution/storagedriver/inmemory" | 	_ "github.com/docker/distribution/storagedriver/inmemory" | ||||||
| 	_ "github.com/docker/distribution/storagedriver/s3" | 	_ "github.com/docker/distribution/storagedriver/s3" | ||||||
| 	"github.com/docker/distribution/version" | 	"github.com/docker/distribution/version" | ||||||
| 	"github.com/gorilla/handlers" | 	gorhandlers "github.com/gorilla/handlers" | ||||||
| 	"github.com/yvasiyarov/gorelic" | 	"github.com/yvasiyarov/gorelic" | ||||||
| 	"golang.org/x/net/context" | 	"golang.org/x/net/context" | ||||||
| ) | ) | ||||||
|  | @ -50,9 +50,9 @@ func main() { | ||||||
| 	ctx = context.WithValue(ctx, "version", version.Version) | 	ctx = context.WithValue(ctx, "version", version.Version) | ||||||
| 	ctx = ctxu.WithLogger(ctx, ctxu.GetLogger(ctx, "version")) | 	ctx = ctxu.WithLogger(ctx, ctxu.GetLogger(ctx, "version")) | ||||||
| 
 | 
 | ||||||
| 	app := registry.NewApp(ctx, *config) | 	app := handlers.NewApp(ctx, *config) | ||||||
| 	handler := configureReporting(app) | 	handler := configureReporting(app) | ||||||
| 	handler = handlers.CombinedLoggingHandler(os.Stdout, handler) | 	handler = gorhandlers.CombinedLoggingHandler(os.Stdout, handler) | ||||||
| 
 | 
 | ||||||
| 	if config.HTTP.Debug.Addr != "" { | 	if config.HTTP.Debug.Addr != "" { | ||||||
| 		go debugServer(config.HTTP.Debug.Addr) | 		go debugServer(config.HTTP.Debug.Addr) | ||||||
|  | @ -118,7 +118,7 @@ func logLevel(level configuration.Loglevel) log.Level { | ||||||
| 	return l | 	return l | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func configureReporting(app *registry.App) http.Handler { | func configureReporting(app *handlers.App) http.Handler { | ||||||
| 	var handler http.Handler = app | 	var handler http.Handler = app | ||||||
| 
 | 
 | ||||||
| 	if app.Config.Reporting.Bugsnag.APIKey != "" { | 	if app.Config.Reporting.Bugsnag.APIKey != "" { | ||||||
|  |  | ||||||
|  | @ -0,0 +1,3 @@ | ||||||
|  | // Package registry is a placeholder package for registry interface
 | ||||||
|  | // destinations and utilities.
 | ||||||
|  | package registry | ||||||
|  | @ -1,4 +1,4 @@ | ||||||
| package registry | package handlers | ||||||
| 
 | 
 | ||||||
| import ( | import ( | ||||||
| 	"bytes" | 	"bytes" | ||||||
|  | @ -1,4 +1,4 @@ | ||||||
| package registry | package handlers | ||||||
| 
 | 
 | ||||||
| import ( | import ( | ||||||
| 	"fmt" | 	"fmt" | ||||||
|  | @ -1,4 +1,4 @@ | ||||||
| package registry | package handlers | ||||||
| 
 | 
 | ||||||
| import ( | import ( | ||||||
| 	"encoding/json" | 	"encoding/json" | ||||||
|  | @ -1,6 +1,6 @@ | ||||||
| // +build go1.4
 | // +build go1.4
 | ||||||
| 
 | 
 | ||||||
| package registry | package handlers | ||||||
| 
 | 
 | ||||||
| import ( | import ( | ||||||
| 	"net/http" | 	"net/http" | ||||||
|  | @ -1,6 +1,6 @@ | ||||||
| // +build !go1.4
 | // +build !go1.4
 | ||||||
| 
 | 
 | ||||||
| package registry | package handlers | ||||||
| 
 | 
 | ||||||
| import ( | import ( | ||||||
| 	"encoding/base64" | 	"encoding/base64" | ||||||
|  | @ -1,4 +1,4 @@ | ||||||
| package registry | package handlers | ||||||
| 
 | 
 | ||||||
| import ( | import ( | ||||||
| 	"fmt" | 	"fmt" | ||||||
|  | @ -1,4 +1,4 @@ | ||||||
| package registry | package handlers | ||||||
| 
 | 
 | ||||||
| import ( | import ( | ||||||
| 	"encoding/json" | 	"encoding/json" | ||||||
|  | @ -1,4 +1,4 @@ | ||||||
| package registry | package handlers | ||||||
| 
 | 
 | ||||||
| import ( | import ( | ||||||
| 	"crypto/hmac" | 	"crypto/hmac" | ||||||
|  | @ -1,4 +1,4 @@ | ||||||
| package registry | package handlers | ||||||
| 
 | 
 | ||||||
| import "testing" | import "testing" | ||||||
| 
 | 
 | ||||||
|  | @ -1,4 +1,4 @@ | ||||||
| package registry | package handlers | ||||||
| 
 | 
 | ||||||
| import ( | import ( | ||||||
| 	"encoding/json" | 	"encoding/json" | ||||||
|  | @ -1,4 +1,4 @@ | ||||||
| package registry | package handlers | ||||||
| 
 | 
 | ||||||
| import ( | import ( | ||||||
| 	"net/http" | 	"net/http" | ||||||
|  | @ -1,4 +1,4 @@ | ||||||
| package registry | package handlers | ||||||
| 
 | 
 | ||||||
| import ( | import ( | ||||||
| 	"fmt" | 	"fmt" | ||||||
|  | @ -1,4 +1,4 @@ | ||||||
| package registry | package handlers | ||||||
| 
 | 
 | ||||||
| import ( | import ( | ||||||
| 	"encoding/json" | 	"encoding/json" | ||||||
		Loading…
	
		Reference in New Issue