Skip to content

Commit f9c5972

Browse files
author
Marcus Linke
committed
Added basic SSL support
1 parent e7f1724 commit f9c5972

File tree

4 files changed

+453
-414
lines changed

4 files changed

+453
-414
lines changed

src/main/java/com/github/dockerjava/core/DockerClientConfig.java

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,16 +73,20 @@ public class DockerClientConfig implements Serializable {
7373

7474
private final SSLConfig sslConfig;
7575

76+
private final String dockerCertPath;
77+
7678
DockerClientConfig(URI uri, String version, String username, String password, String email, String serverAddress,
77-
String dockerCfgPath, SSLConfig sslConfig) {
79+
String dockerCfgPath, String dockerCertPath, SSLConfig sslConfig) {
7880
this.uri = uri;
7981
this.version = RemoteApiVersion.parseConfigWithDefault(version);
8082
this.username = username;
8183
this.password = password;
8284
this.email = email;
8385
this.serverAddress = serverAddress;
86+
8487
this.dockerCfgPath = dockerCfgPath;
8588
this.sslConfig = sslConfig;
89+
this.dockerCertPath = dockerCertPath;
8690
}
8791

8892
private static Properties loadIncludedDockerProperties(Properties systemProperties) {
@@ -240,6 +244,10 @@ public String getDockerCfgPath() {
240244
return dockerCfgPath;
241245
}
242246

247+
public String getDockerCertPath() {
248+
return dockerCertPath;
249+
}
250+
243251
private AuthConfig getAuthConfig() {
244252
AuthConfig authConfig = null;
245253
if (getUsername() != null && getPassword() != null && getEmail() != null && getServerAddress() != null) {
@@ -346,7 +354,7 @@ public String toString() {
346354
public static class DockerClientConfigBuilder {
347355
private URI uri;
348356

349-
private String version, username, password, email, serverAddress, dockerCfgPath;
357+
private String version, username, password, email, serverAddress, dockerCfgPath, dockerCertPath;
350358

351359
private SSLConfig sslConfig;
352360

@@ -401,6 +409,7 @@ public DockerClientConfigBuilder withServerAddress(String serverAddress) {
401409
public final DockerClientConfigBuilder withDockerCertPath(String dockerCertPath) {
402410
if (dockerCertPath != null) {
403411
this.sslConfig = new LocalDirectorySSLConfig(dockerCertPath);
412+
this.dockerCertPath = dockerCertPath;
404413
}
405414
return this;
406415
}
@@ -416,7 +425,7 @@ public final DockerClientConfigBuilder withSSLConfig(SSLConfig config) {
416425
}
417426

418427
public DockerClientConfig build() {
419-
return new DockerClientConfig(uri, version, username, password, email, serverAddress, dockerCfgPath,
428+
return new DockerClientConfig(uri, version, username, password, email, serverAddress, dockerCfgPath, dockerCertPath,
420429
sslConfig);
421430
}
422431
}

0 commit comments

Comments
 (0)