Skip to content

Commit

Permalink
Find the correct app's SSH URL when no instance or default is given
Browse files Browse the repository at this point in the history
This uses the instance-based SSH URL if an app default URL is not available and
the $instance is not provided. So it avoids falling back to the environment's
default SSH URL in more cases.
  • Loading branch information
pjcdawkins committed Oct 26, 2022
1 parent 325c264 commit caaf59a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Model/Environment.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ public function getHeadCommit()
public function getSshUrl($app = '', $instance = '')
{
$urls = $this->getSshUrls();
$instances = $this->getSshInstanceURLs($app, $urls);
if ($instance !== '' && $instance !== null) {
$instances = $this->getSshInstanceURLs($app, $urls);
if (isset($instances[$instance])) {
return $instances[$instance];
}
Expand All @@ -132,6 +132,9 @@ public function getSshUrl($app = '', $instance = '')
if (isset($urls[$app])) {
return $urls[$app];
}
if (!empty($instances)) {
return reset($instances);
}

// Fall back to the legacy SSH URL.
return $this->constructLegacySshUrl();
Expand Down

0 comments on commit caaf59a

Please sign in to comment.