message: add a timeout in the stub file to fail faster if the api/ssh is unavailable
diff: // <?php // small hack so our IDE syntax highlighting still works
  global $endpoint;
  global $api;
  +global $ssh_port_timeout;
  use Symfony\Component\Yaml\Yaml;
  @@ -21,6 +22,12 @@ if (getenv('LAGOON_OVERRIDE_SSH')) {
  drush_log("LAGOON_OVERRIDE_SSH is set, using '$ssh' as ssh");
  }
  +// sometimes ssh port may not available, so we should be able to fail sooner
  +if (getenv('LAGOON_OVERRIDE_SSH_TIMEOUT')) {
  + $ssh_port_timeout = getenv('LAGOON_OVERRIDE_SSH_TIMEOUT');
  + drush_log("LAGOON_OVERRIDE_SSH_TIMEOUT is set, using '$ssh_port_timeout' as endpoint timeout");
  +}
  +
  if (getenv('LAGOON_OVERRIDE_API')) {
  $api = getenv('LAGOON_OVERRIDE_API');
  drush_log("LAGOON_OVERRIDE_API is set, using '$api' as endpoint");
  @@ -108,6 +115,14 @@ if ($lagoonyml_path) {
  }
  }
  + // sometimes ssh port may not reachable, so we should be able to fail sooner
  + if (empty($ssh_port_timeout)) {
  + if ($lagoonyml['ssh_port_timeout']) {
  + $ssh_port_timeout = $lagoonyml['ssh_port_timeout'];
  + drush_log("Discovered ssh_port_timeout '$ssh_port_timeout' from .lagoon.yml file");
  + }
  + }
  +
  } else {
  drush_log('Could not find .lagoon.yml file.');
  }
  @@ -162,6 +177,21 @@ if (isset($cache->data) && time() < $cache->expire && getenv('LAGOON_IGNORE_DRUS
  return;
  }
  +// sometimes ssh port may not available, so we should be able to fail sooner
  +// can set an env var `LAGOON_OVERRIDE_SSH_TIMEOUT=<val>` or define `ssh_port_timeout: <val>` in `.lagoon.yml` to a time in seconds to fail sooner and let user know why
  +// if there is no defined timeout further up, set a value
  +if (empty($ssh_port_timeout)) {
  + $ssh_port_timeout = 10; //default timeout
  +}
  +$ssh_port_check = @fsockopen($ssh_host, $ssh_port, $errno, $errstr, $ssh_port_timeout);
  +if (is_resource($ssh_port_check))
  +{
  + fclose($ssh_port_check);
  +} else {
  + drush_log("Could not connect to ".$ssh_host." port ".$ssh_port.", error was ".$errno.":".$errstr.".", 'warning');
  + return;
  +}
  +
  $jwttoken_cache = drush_cache_get("lagoon_jwttoken");
  if (getenv('LAGOON_OVERRIDE_JWT_TOKEN')) {
  