@@ -7,10 +7,6 @@ import { ContainerRuntimeClientStrategyResult } from "./types";
77import { getContainerRuntimeConfig } from "./utils/config" ;
88
99export class ConfigurationStrategy implements ContainerRuntimeClientStrategy {
10- private dockerHost ! : string ;
11- private dockerTlsVerify : string | undefined ;
12- private dockerCertPath : string | undefined ;
13-
1410 getName ( ) : string {
1511 return "ConfigurationStrategy" ;
1612 }
@@ -22,33 +18,29 @@ export class ConfigurationStrategy implements ContainerRuntimeClientStrategy {
2218 return undefined ;
2319 }
2420
25- this . dockerHost = dockerHost ;
26- this . dockerTlsVerify = dockerTlsVerify ;
27- this . dockerCertPath = dockerCertPath ;
28-
2921 const dockerOptions : DockerOptions = { } ;
3022
31- const { pathname, hostname, port } = new URL ( this . dockerHost ) ;
23+ const { pathname, hostname, port } = new URL ( dockerHost ) ;
3224 if ( hostname !== "" ) {
3325 dockerOptions . host = hostname ;
3426 dockerOptions . port = port ;
3527 } else {
3628 dockerOptions . socketPath = pathname ;
3729 }
3830
39- if ( this . dockerTlsVerify === "1" && this . dockerCertPath !== undefined ) {
40- dockerOptions . ca = await fs . readFile ( path . resolve ( this . dockerCertPath , "ca.pem" ) ) ;
41- dockerOptions . cert = await fs . readFile ( path . resolve ( this . dockerCertPath , "cert.pem" ) ) ;
42- dockerOptions . key = await fs . readFile ( path . resolve ( this . dockerCertPath , "key.pem" ) ) ;
31+ if ( dockerTlsVerify === "1" && dockerCertPath !== undefined ) {
32+ dockerOptions . ca = await fs . readFile ( path . resolve ( dockerCertPath , "ca.pem" ) ) ;
33+ dockerOptions . cert = await fs . readFile ( path . resolve ( dockerCertPath , "cert.pem" ) ) ;
34+ dockerOptions . key = await fs . readFile ( path . resolve ( dockerCertPath , "key.pem" ) ) ;
4335 }
4436
4537 return {
46- uri : this . dockerHost ,
38+ uri : dockerHost ,
4739 dockerOptions,
4840 composeEnvironment : {
49- DOCKER_HOST : this . dockerHost ,
50- DOCKER_TLS_VERIFY : this . dockerTlsVerify ,
51- DOCKER_CERT_PATH : this . dockerCertPath ,
41+ DOCKER_HOST : dockerHost ,
42+ DOCKER_TLS_VERIFY : dockerTlsVerify ,
43+ DOCKER_CERT_PATH : dockerCertPath ,
5244 } ,
5345 allowUserOverrides : true ,
5446 } ;
0 commit comments