From f290f446329fcf1c56c5705353b340050ef8a8c5 Mon Sep 17 00:00:00 2001 From: Derek McGowan Date: Wed, 8 Oct 2014 14:03:39 -0700 Subject: [PATCH] Use direct registry url Signed-off-by: Derek McGowan (github: dmcgowan) --- docs/auth.go | 13 ++++++++----- docs/session_v2.go | 8 ++++++-- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/docs/auth.go b/docs/auth.go index 906a37dd..7c0709a4 100644 --- a/docs/auth.go +++ b/docs/auth.go @@ -14,13 +14,16 @@ import ( "github.com/docker/docker/utils" ) -// Where we store the config file -const CONFIGFILE = ".dockercfg" +const ( + // Where we store the config file + CONFIGFILE = ".dockercfg" -// Only used for user auth + account creation -const INDEXSERVER = "https://index.docker.io/v1/" + // Only used for user auth + account creation + INDEXSERVER = "https://index.docker.io/v1/" + REGISTRYSERVER = "https://registry-1.docker.io/v1/" -//const INDEXSERVER = "https://registry-stage.hub.docker.com/v1/" + // INDEXSERVER = "https://registry-stage.hub.docker.com/v1/" +) var ( ErrConfigFileMissing = errors.New("The Auth config file is missing") diff --git a/docs/session_v2.go b/docs/session_v2.go index 2e0de49b..c63cf710 100644 --- a/docs/session_v2.go +++ b/docs/session_v2.go @@ -57,10 +57,14 @@ func getV2URL(e *Endpoint, routeName string, vars map[string]string) (*url.URL, if err != nil { return nil, fmt.Errorf("unable to make registry route %q with vars %v: %s", routeName, vars, err) } + u, err := url.Parse(REGISTRYSERVER) + if err != nil { + return nil, fmt.Errorf("invalid registry url: %s", err) + } return &url.URL{ - Scheme: e.URL.Scheme, - Host: e.URL.Host, + Scheme: u.Scheme, + Host: u.Host, Path: routePath.Path, }, nil }