Browse code

Use direct registry url

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)

Derek McGowan authored on 2014/10/09 06:03:39
Showing 2 changed files
... ...
@@ -14,13 +14,16 @@ import (
14 14
 	"github.com/docker/docker/utils"
15 15
 )
16 16
 
17
-// Where we store the config file
18
-const CONFIGFILE = ".dockercfg"
17
+const (
18
+	// Where we store the config file
19
+	CONFIGFILE = ".dockercfg"
19 20
 
20
-// Only used for user auth + account creation
21
-const INDEXSERVER = "https://index.docker.io/v1/"
21
+	// Only used for user auth + account creation
22
+	INDEXSERVER    = "https://index.docker.io/v1/"
23
+	REGISTRYSERVER = "https://registry-1.docker.io/v1/"
22 24
 
23
-//const INDEXSERVER = "https://registry-stage.hub.docker.com/v1/"
25
+	// INDEXSERVER = "https://registry-stage.hub.docker.com/v1/"
26
+)
24 27
 
25 28
 var (
26 29
 	ErrConfigFileMissing = errors.New("The Auth config file is missing")
... ...
@@ -57,10 +57,14 @@ func getV2URL(e *Endpoint, routeName string, vars map[string]string) (*url.URL,
57 57
 	if err != nil {
58 58
 		return nil, fmt.Errorf("unable to make registry route %q with vars %v: %s", routeName, vars, err)
59 59
 	}
60
+	u, err := url.Parse(REGISTRYSERVER)
61
+	if err != nil {
62
+		return nil, fmt.Errorf("invalid registry url: %s", err)
63
+	}
60 64
 
61 65
 	return &url.URL{
62
-		Scheme: e.URL.Scheme,
63
-		Host:   e.URL.Host,
66
+		Scheme: u.Scheme,
67
+		Host:   u.Host,
64 68
 		Path:   routePath.Path,
65 69
 	}, nil
66 70
 }