11package util
22
3+ import api .{DockerClient , DockerClientConfig }
34import model .Connection
45import org .scalajs .dom .ext .Ajax .InputData
56import util .logger .log
@@ -12,6 +13,7 @@ class ModemOptions(val socketPath: String,
1213 val host : String ,
1314 val protocol : String ,
1415 val port : String ,
16+ val timeout : Int ,
1517 val ca : js.UndefOr [InputData ] = js.undefined,
1618 val cert : js.UndefOr [InputData ] = js.undefined,
1719 val key : js.UndefOr [InputData ] = js.undefined
@@ -48,7 +50,7 @@ object DockerModem {
4850 log.debug(s " Building Docker modem for Url: $connection" )
4951 val modemOptions = {
5052 if (connection.url.toLowerCase().startsWith(" unix://" )) {
51- new ModemOptions (socketPath = connection.url.drop(" unix://" .size), host = " localhost" , protocol = " http" , port = null )
53+ new ModemOptions (socketPath = connection.url.drop(" unix://" .size), host = " localhost" , timeout = 2000 , protocol = " http" , port = null )
5254 } else {
5355 val protocol = connection.url.takeWhile(_ != ':' )
5456 val host = connection.url.drop(protocol.size).drop(" ://" .size).takeWhile(_ != ':' )
@@ -71,7 +73,7 @@ object DockerModem {
7173 (js.undefined, js.undefined, js.undefined)
7274 }
7375
74- new ModemOptions (socketPath = null , host = host, protocol = protocol, port = port, ca = envCa, cert = envCert, key = envKey)
76+ new ModemOptions (socketPath = null , host = host, protocol = protocol, port = port, ca = envCa, cert = envCert, key = envKey, timeout = DockerClientConfig . HttpTimeOut )
7577 }
7678 }
7779 log.debug(s " modemOptions: protocol: ${modemOptions.protocol} path: ${modemOptions.socketPath}" )
0 commit comments