mirror of https://github.com/docker/docs.git
if we can't connect to the server when setting up, return a nil roundtripper. Check roundtripper when initializing HTTPStore and substitute an OfflineStore if it is nil.
Signed-off-by: David Lawrence <david.lawrence@docker.com> (github: endophage)
This commit is contained in:
parent
cf0bb5a9be
commit
46682b71eb
|
@ -426,7 +426,9 @@ func tokenAuth(config *viper.Viper, baseTransport *http.Transport, gun string,
|
||||||
}
|
}
|
||||||
resp, err := pingClient.Do(req)
|
resp, err := pingClient.Do(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fatalf(err.Error())
|
logrus.Errorf("could not reach %s: %s", trustServerURL, err.Error())
|
||||||
|
logrus.Info("continuing in offline mode")
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
|
|
||||||
|
|
|
@ -85,6 +85,9 @@ func NewHTTPStore(baseURL, metaPrefix, metaExtension, targetsPrefix, keyExtensio
|
||||||
if !base.IsAbs() {
|
if !base.IsAbs() {
|
||||||
return nil, errors.New("HTTPStore requires an absolute baseURL")
|
return nil, errors.New("HTTPStore requires an absolute baseURL")
|
||||||
}
|
}
|
||||||
|
if roundTrip == nil {
|
||||||
|
return &OfflineStore{}, nil
|
||||||
|
}
|
||||||
return &HTTPStore{
|
return &HTTPStore{
|
||||||
baseURL: *base,
|
baseURL: *base,
|
||||||
metaPrefix: metaPrefix,
|
metaPrefix: metaPrefix,
|
||||||
|
|
Loading…
Reference in New Issue