Find docker index URL in ENV before using default value. Unit tests for docker pull

Upstream-commit: fc1d1d871b2f952ce83a6b7cedcdf4a86f0c953b
Component: engine
This commit is contained in:
shin-
2013-05-08 10:21:21 -07:00
committed by Guillaume J. Charmes
parent 28103013e9
commit 7c7dc4a8d7
3 changed files with 72 additions and 2 deletions

View File

@ -33,6 +33,13 @@ func NewAuthConfig(username, password, email, rootPath string) *AuthConfig {
}
}
func IndexServerAddress() string {
if os.Getenv("DOCKER_INDEX_URL") != "" {
return os.Getenv("DOCKER_INDEX_URL")
}
return INDEX_SERVER
}
// create a base64 encoded auth string to store in config
func EncodeAuth(authConfig *AuthConfig) string {
authStr := authConfig.Username + ":" + authConfig.Password