@@ -23,6 +23,7 @@ public class DockerClientConfig {
2323 // this is really confusing, as there are two ways to spell it
2424 private static final String DOCKER_IO_ENABLE_LOGGING_FILTER_PROPERTY = "docker.io.enableLoggingFilter" ;
2525 private static final String DOCKER_IO_DOCKER_CERT_PATH_PROPERTY = "docker.io.dockerCertPath" ;
26+ private static final String DOCKER_IO_DOCKER_CFG_PATH_PROPERTY = "docker.io.dockerCfgPath" ;
2627 /**
2728 * A map from the environment name to the interval name.
2829 */
@@ -36,21 +37,23 @@ public class DockerClientConfig {
3637 .put ("DOCKER_READ_TIMEOUT" , DOCKER_IO_READ_TIMEOUT_PROPERTY )
3738 .put ("DOCKER_LOGGING_FILTER_ENABLED" , DOCKER_IO_ENABLE_LOGGING_FILTER_PROPERTY )
3839 .put (DOCKER_CERT_PATH_PROPERTY , DOCKER_IO_DOCKER_CERT_PATH_PROPERTY )
40+ .put ("DOCKER_CFG_PATH" , DOCKER_IO_DOCKER_CFG_PATH_PROPERTY )
3941 .build ();
4042 private static final String DOCKER_IO_PROPERTIES_PROPERTY = "docker.io.properties" ;
4143 private final URI uri ;
42- private final String version , username , password , email , serverAddress , dockerCertPath ;
44+ private final String version , username , password , email , serverAddress , dockerCertPath , dockerCfgPath ;
4345 private final Integer readTimeout ;
4446 private final boolean loggingFilterEnabled ;
4547
46- DockerClientConfig (URI uri , String version , String username , String password , String email , String serverAddress , String dockerCertPath , Integer readTimeout , boolean loggingFilterEnabled ) {
48+ DockerClientConfig (URI uri , String version , String username , String password , String email , String serverAddress , String dockerCertPath , String dockerCfgPath , Integer readTimeout , boolean loggingFilterEnabled ) {
4749 this .uri = uri ;
4850 this .version = version ;
4951 this .username = username ;
5052 this .password = password ;
5153 this .email = email ;
5254 this .serverAddress = serverAddress ;
5355 this .dockerCertPath = dockerCertPath ;
56+ this .dockerCfgPath = dockerCfgPath ;
5457 this .readTimeout = readTimeout ;
5558 this .loggingFilterEnabled = loggingFilterEnabled ;
5659 }
@@ -153,6 +156,7 @@ private static Properties overrideDockerPropertiesWithSystemProperties(Propertie
153156 DOCKER_IO_READ_TIMEOUT_PROPERTY ,
154157 DOCKER_IO_ENABLE_LOGGING_FILTER_PROPERTY ,
155158 DOCKER_IO_DOCKER_CERT_PATH_PROPERTY ,
159+ DOCKER_IO_DOCKER_CFG_PATH_PROPERTY ,
156160 }) {
157161 if (systemProperties .containsKey (key )) {
158162 overriddenProperties .setProperty (key , systemProperties .getProperty (key ));
@@ -212,6 +216,10 @@ public String getDockerCertPath() {
212216 return dockerCertPath ;
213217 }
214218
219+ public String getDockerCfgPath () {
220+ return dockerCfgPath ;
221+ }
222+
215223 @ Override
216224 public boolean equals (Object o ) {
217225 if (this == o ) return true ;
@@ -222,6 +230,8 @@ public boolean equals(Object o) {
222230 if (loggingFilterEnabled != that .loggingFilterEnabled ) return false ;
223231 if (dockerCertPath != null ? !dockerCertPath .equals (that .dockerCertPath ) : that .dockerCertPath != null )
224232 return false ;
233+ if (dockerCfgPath != null ? !dockerCfgPath .equals (that .dockerCfgPath ) : that .dockerCfgPath != null )
234+ return false ;
225235 if (email != null ? !email .equals (that .email ) : that .email != null ) return false ;
226236 if (password != null ? !password .equals (that .password ) : that .password != null ) return false ;
227237 if (readTimeout != null ? !readTimeout .equals (that .readTimeout ) : that .readTimeout != null ) return false ;
@@ -243,6 +253,7 @@ public int hashCode() {
243253 result = 31 * result + (email != null ? email .hashCode () : 0 );
244254 result = 31 * result + (serverAddress != null ? serverAddress .hashCode () : 0 );
245255 result = 31 * result + (dockerCertPath != null ? dockerCertPath .hashCode () : 0 );
256+ result = 31 * result + (dockerCfgPath != null ? dockerCfgPath .hashCode () : 0 );
246257 result = 31 * result + (readTimeout != null ? readTimeout .hashCode () : 0 );
247258 result = 31 * result + (loggingFilterEnabled ? 1 : 0 );
248259 return result ;
@@ -258,22 +269,23 @@ public String toString() {
258269 ", email='" + email + '\'' +
259270 ", serverAddress='" + serverAddress + '\'' +
260271 ", dockerCertPath='" + dockerCertPath + '\'' +
272+ ", dockerCfgPath='" + dockerCfgPath + '\'' +
261273 ", readTimeout=" + readTimeout +
262274 ", loggingFilterEnabled=" + loggingFilterEnabled +
263275 '}' ;
264276 }
265277
266278 public static class DockerClientConfigBuilder {
267279 private URI uri ;
268- private String version , username , password , email , serverAddress , dockerCertPath ;
280+ private String version , username , password , email , serverAddress , dockerCertPath , dockerCfgPath ;
269281 private Integer readTimeout ;
270282 private boolean loggingFilterEnabled ;
271283
272284 /**
273285 * This will set all fields in the builder to those contained in the Properties object. The Properties object
274- * should contain the following docker.io.* keys: url, version, username, password, email, and dockerCertPath. If
275- * docker.io.readTimeout or docker.io.enableLoggingFilter are not contained, they will be set to 1000 and true,
276- * respectively.
286+ * should contain the following docker.io.* keys: url, version, username, password, email, dockerCertPath, and
287+ * dockerCfgPath. If docker.io.readTimeout or docker.io.enableLoggingFilter are not contained, they will be set
288+ * to 1000 and true, respectively.
277289 */
278290 public DockerClientConfigBuilder withProperties (Properties p ) {
279291 return withUri (p .getProperty (DOCKER_IO_URL_PROPERTY ))
@@ -284,7 +296,8 @@ public DockerClientConfigBuilder withProperties(Properties p) {
284296 .withServerAddress (p .getProperty (DOCKER_IO_SERVER_ADDRESS_PROPERTY ))
285297 .withReadTimeout (Integer .valueOf (p .getProperty (DOCKER_IO_READ_TIMEOUT_PROPERTY , "0" )))
286298 .withLoggingFilter (Boolean .valueOf (p .getProperty (DOCKER_IO_ENABLE_LOGGING_FILTER_PROPERTY , "true" )))
287- .withDockerCertPath (p .getProperty (DOCKER_IO_DOCKER_CERT_PATH_PROPERTY ));
299+ .withDockerCertPath (p .getProperty (DOCKER_IO_DOCKER_CERT_PATH_PROPERTY ))
300+ .withDockerCfgPath (p .getProperty (DOCKER_IO_DOCKER_CFG_PATH_PROPERTY ));
288301 }
289302
290303 public final DockerClientConfigBuilder withUri (String uri ) {
@@ -333,6 +346,12 @@ public final DockerClientConfigBuilder withDockerCertPath(String dockerCertPath)
333346 return this ;
334347 }
335348
349+ public final DockerClientConfigBuilder withDockerCfgPath (String dockerCfgPath ) {
350+ this .dockerCfgPath = dockerCfgPath ;
351+ return this ;
352+ }
353+
354+
336355 public DockerClientConfig build () {
337356 return new DockerClientConfig (
338357 uri ,
@@ -342,6 +361,7 @@ public DockerClientConfig build() {
342361 email ,
343362 serverAddress ,
344363 dockerCertPath ,
364+ dockerCfgPath ,
345365 readTimeout ,
346366 loggingFilterEnabled
347367 );
0 commit comments