Merge pull request #38909 from thaJeztah/fix_version_override

Fix client version not being pinned when set
This commit is contained in:
Tibor Vass 2019-03-21 14:14:39 -07:00 committed by GitHub
commit 6cce52c245
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -45,8 +45,9 @@ func FromEnv(c *Client) error {
}
if version := os.Getenv("DOCKER_API_VERSION"); version != "" {
c.version = version
c.manualOverride = true
if err := WithVersion(version)(c); err != nil {
return err
}
}
return nil
}
@ -139,6 +140,7 @@ func WithTLSClientConfig(cacertPath, certPath, keyPath string) func(*Client) err
func WithVersion(version string) func(*Client) error {
return func(c *Client) error {
c.version = version
c.manualOverride = true
return nil
}
}