Skip to content

Commit

Permalink
Merge pull request #23 from skyred/patch-1
Browse files Browse the repository at this point in the history
#22 package doesn't exit safely in non-lagoon environment
  • Loading branch information
bomoko authored Nov 12, 2023
2 parents 86a9204 + bb3db86 commit eb9ca01
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions src/LagoonCommands.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,20 +64,22 @@ class LagoonCommands extends DrushCommands implements SiteAliasManagerAwareInter
* {@inheritdoc}
*/
public function __construct() {
// Get default config.
$lagoonyml = $this->getLagoonYml();
$this->api = $lagoonyml['api'] ?? 'https://api.lagoon.amazeeio.cloud/graphql';
$this->endpoint = $lagoonyml['ssh'] ?? 'ssh.lagoon.amazeeio.cloud:32222';
$this->jwt_token = getenv('LAGOON_OVERRIDE_JWT_TOKEN');
$this->projectName = $lagoonyml['project'] ?? '';
$this->ssh_port_timeout = $lagoonyml['ssh_port_timeout'] ?? 30;

// Allow environment variable overrides.
$this->api = getenv('LAGOON_OVERRIDE_API') ?: $this->api;
$this->endpoint = getenv('LAGOON_OVERRIDE_SSH') ?: $this->endpoint;
$this->projectName = getenv('LAGOON_PROJECT') ?: $this->projectName;
$this->sshTimeout = getenv('LAGOON_OVERRIDE_SSH_TIMEOUT') ?: $this->sshTimeout;
$this->sshKey = getenv('LAGOON_SSH_KEY');
if (getenv('LAGOON')) {
// Get default config.
$lagoonyml = $this->getLagoonYml();
$this->api = $lagoonyml['api'] ?? 'https://api.lagoon.amazeeio.cloud/graphql';
$this->endpoint = $lagoonyml['ssh'] ?? 'ssh.lagoon.amazeeio.cloud:32222';
$this->jwt_token = getenv('LAGOON_OVERRIDE_JWT_TOKEN');
$this->projectName = $lagoonyml['project'] ?? '';
$this->ssh_port_timeout = $lagoonyml['ssh_port_timeout'] ?? 30;

// Allow environment variable overrides.
$this->api = getenv('LAGOON_OVERRIDE_API') ?: $this->api;
$this->endpoint = getenv('LAGOON_OVERRIDE_SSH') ?: $this->endpoint;
$this->projectName = getenv('LAGOON_PROJECT') ?: $this->projectName;
$this->sshTimeout = getenv('LAGOON_OVERRIDE_SSH_TIMEOUT') ?: $this->sshTimeout;
$this->sshKey = getenv('LAGOON_SSH_KEY');
}
}

/**
Expand Down

0 comments on commit eb9ca01

Please sign in to comment.