Skip to content

Commit eb9ca01

Browse files
authored
Merge pull request #23 from skyred/patch-1
#22 package doesn't exit safely in non-lagoon environment
2 parents 86a9204 + bb3db86 commit eb9ca01

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

src/LagoonCommands.php

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -64,20 +64,22 @@ class LagoonCommands extends DrushCommands implements SiteAliasManagerAwareInter
6464
* {@inheritdoc}
6565
*/
6666
public function __construct() {
67-
// Get default config.
68-
$lagoonyml = $this->getLagoonYml();
69-
$this->api = $lagoonyml['api'] ?? 'https://api.lagoon.amazeeio.cloud/graphql';
70-
$this->endpoint = $lagoonyml['ssh'] ?? 'ssh.lagoon.amazeeio.cloud:32222';
71-
$this->jwt_token = getenv('LAGOON_OVERRIDE_JWT_TOKEN');
72-
$this->projectName = $lagoonyml['project'] ?? '';
73-
$this->ssh_port_timeout = $lagoonyml['ssh_port_timeout'] ?? 30;
74-
75-
// Allow environment variable overrides.
76-
$this->api = getenv('LAGOON_OVERRIDE_API') ?: $this->api;
77-
$this->endpoint = getenv('LAGOON_OVERRIDE_SSH') ?: $this->endpoint;
78-
$this->projectName = getenv('LAGOON_PROJECT') ?: $this->projectName;
79-
$this->sshTimeout = getenv('LAGOON_OVERRIDE_SSH_TIMEOUT') ?: $this->sshTimeout;
80-
$this->sshKey = getenv('LAGOON_SSH_KEY');
67+
if (getenv('LAGOON')) {
68+
// Get default config.
69+
$lagoonyml = $this->getLagoonYml();
70+
$this->api = $lagoonyml['api'] ?? 'https://api.lagoon.amazeeio.cloud/graphql';
71+
$this->endpoint = $lagoonyml['ssh'] ?? 'ssh.lagoon.amazeeio.cloud:32222';
72+
$this->jwt_token = getenv('LAGOON_OVERRIDE_JWT_TOKEN');
73+
$this->projectName = $lagoonyml['project'] ?? '';
74+
$this->ssh_port_timeout = $lagoonyml['ssh_port_timeout'] ?? 30;
75+
76+
// Allow environment variable overrides.
77+
$this->api = getenv('LAGOON_OVERRIDE_API') ?: $this->api;
78+
$this->endpoint = getenv('LAGOON_OVERRIDE_SSH') ?: $this->endpoint;
79+
$this->projectName = getenv('LAGOON_PROJECT') ?: $this->projectName;
80+
$this->sshTimeout = getenv('LAGOON_OVERRIDE_SSH_TIMEOUT') ?: $this->sshTimeout;
81+
$this->sshKey = getenv('LAGOON_SSH_KEY');
82+
}
8183
}
8284

8385
/**

0 commit comments

Comments
 (0)