mirror of
https://github.com/andres-montanez/Magallanes
synced 2024-05-04 23:13:16 +02:00
Merge 68206ec4d9
into 8db7a005f6
This commit is contained in:
commit
fe8a7ad5a8
|
@ -51,6 +51,11 @@ class Runtime
|
|||
*/
|
||||
protected $workingHost = null;
|
||||
|
||||
/**
|
||||
* @var string|null The port being deployed to
|
||||
*/
|
||||
protected $workingPort = null;
|
||||
|
||||
/**
|
||||
* @var string|null The Release ID
|
||||
*/
|
||||
|
@ -348,7 +353,11 @@ class Runtime
|
|||
*/
|
||||
public function setWorkingHost($host)
|
||||
{
|
||||
$this->workingHost = $host;
|
||||
//in case port notation is used take only 1st part
|
||||
$this->workingHost = explode(':', $host)[0];
|
||||
|
||||
$port = explode(':', $host);
|
||||
$this->workingPort = isset($port[1]) ? $port[1] : null;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
@ -362,6 +371,16 @@ class Runtime
|
|||
return $this->workingHost;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current Host Port or default ssh port
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getWorkingPort()
|
||||
{
|
||||
return $this->workingPort;
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs a Message into the Logger
|
||||
*
|
||||
|
@ -459,8 +478,8 @@ class Runtime
|
|||
{
|
||||
$sshConfig = $this->getEnvOption('ssh', ['port' => 22, 'flags' => '-q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no']);
|
||||
|
||||
if ($this->getHostPort() !== null) {
|
||||
$sshConfig['port'] = $this->getHostPort();
|
||||
if ($this->getWorkingPort() !== null) {
|
||||
$sshConfig['port'] = $this->getWorkingPort();
|
||||
}
|
||||
|
||||
if (!array_key_exists('port', $sshConfig)) {
|
||||
|
@ -474,17 +493,6 @@ class Runtime
|
|||
return $sshConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current Host Port or default ssh port
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getHostPort()
|
||||
{
|
||||
$info = explode(':', $this->getWorkingHost());
|
||||
return isset($info[1]) ? $info[1] : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a Temporal File name
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue