This repository was archived by the owner on Mar 21, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +6
-4
lines changed
main/java/com/spotify/docker/client
test/java/com/spotify/docker/client Expand file tree Collapse file tree 3 files changed +6
-4
lines changed Original file line number Diff line number Diff line change 125125import javax .ws .rs .core .MediaType ;
126126import javax .ws .rs .core .Response ;
127127
128+ import static com .google .common .base .MoreObjects .firstNonNull ;
128129import static com .google .common .base .Optional .fromNullable ;
129130import static com .google .common .base .Preconditions .checkArgument ;
130131import static com .google .common .base .Preconditions .checkNotNull ;
@@ -1681,7 +1682,8 @@ public static Builder builder() {
16811682 */
16821683 public static Builder fromEnv () throws DockerCertificateException {
16831684 final String endpoint = DockerHost .endpointFromEnv ();
1684- final Path dockerCertPath = Paths .get (DockerHost .certPathFromEnv ());
1685+ final Path dockerCertPath = Paths .get (firstNonNull (DockerHost .certPathFromEnv (),
1686+ DockerHost .defaultCertPath ()));
16851687
16861688 final Builder builder = new Builder ();
16871689
Original file line number Diff line number Diff line change @@ -213,7 +213,7 @@ static String defaultCertPath() {
213213 }
214214
215215 static String certPathFromEnv () {
216- return firstNonNull ( systemDelegate .getenv ("DOCKER_CERT_PATH" ), defaultCertPath () );
216+ return systemDelegate .getenv ("DOCKER_CERT_PATH" );
217217 }
218218
219219 @ Override
Original file line number Diff line number Diff line change @@ -98,7 +98,7 @@ public void testCertPathFromEnv() throws Exception {
9898 DockerHost .setSystemDelegate (systemDelegate );
9999
100100 assertThat (DockerHost .certPathFromEnv (), equalTo ("foo" ));
101- assertThat (DockerHost .certPathFromEnv (), equalTo ("bar/.docker" ));
101+ assertThat (DockerHost .certPathFromEnv (), equalTo (null ));
102102 }
103103
104104 @ Test
@@ -151,7 +151,7 @@ public void testFromEnv() throws Exception {
151151 final String dockerHostEnvVar = DockerHost .defaultDockerEndpoint ();
152152 final boolean isUnixSocket = dockerHostEnvVar .startsWith ("unix://" );
153153 final URI dockerHostUri = new URI (dockerHostEnvVar );
154- final String dockerCertPathEnvVar = DockerHost . defaultCertPath () ;
154+ final String dockerCertPathEnvVar = null ;
155155
156156 final String dockerHostAndPort ;
157157 final URI dockerHostHttpUri ;
You can’t perform that action at this time.
0 commit comments