Skip to content

Commit caaf59a

Browse files
committed
Find the correct app's SSH URL when no instance or default is given
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.
1 parent 325c264 commit caaf59a

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/Model/Environment.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,8 @@ public function getHeadCommit()
118118
public function getSshUrl($app = '', $instance = '')
119119
{
120120
$urls = $this->getSshUrls();
121+
$instances = $this->getSshInstanceURLs($app, $urls);
121122
if ($instance !== '' && $instance !== null) {
122-
$instances = $this->getSshInstanceURLs($app, $urls);
123123
if (isset($instances[$instance])) {
124124
return $instances[$instance];
125125
}
@@ -132,6 +132,9 @@ public function getSshUrl($app = '', $instance = '')
132132
if (isset($urls[$app])) {
133133
return $urls[$app];
134134
}
135+
if (!empty($instances)) {
136+
return reset($instances);
137+
}
135138

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

0 commit comments

Comments
 (0)