Skip to content

Commit

Permalink
fixed OAuthClient.php
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanwilliammd committed Apr 10, 2024
1 parent bc77be5 commit c08cc7c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/OAuth2Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,23 +63,23 @@ public function __construct()
$this->organization_id = getenv('ORGID_DEV');
}

if (empty($this->satusehat_env)) {
if (empty($this->satusehat_env) && !$this->override) {
throw new OAuth2ClientException('SATUSEHAT environment is missing');
}

if (!in_array($this->satusehat_env, ['DEV', 'STG', 'PROD'])) {
if (!in_array($this->satusehat_env, ['DEV', 'STG', 'PROD']) && !$this->override) {
throw new OAuth2ClientException('SATUSEHAT environment invalid, supported (DEV, STG, PROD). ' . $this->satusehat_env . ' given.');
}

if ($this->satusehat_env == 'DEV' && (empty($this->client_id) || empty($this->client_secret || empty($this->organization_id)))) {
if ($this->satusehat_env == 'DEV' && (empty($this->client_id) || empty($this->client_secret || empty($this->organization_id))) && !$this->override) {
throw new OAuth2ClientException('SATUSEHAT environment defined as DEV, but CLIENTID_DEV / CLIENTSECRET_DEV / ORGID_DEV not set');
}

if ($this->satusehat_env == 'STG' && (empty($this->client_id) || empty($this->client_secret || empty($this->organization_id)))) {
if ($this->satusehat_env == 'STG' && (empty($this->client_id) || empty($this->client_secret || empty($this->organization_id))) && !$this->override) {
throw new OAuth2ClientException('SATUSEHAT environment defined as STG, but CLIENTID_STG / CLIENTSECRET_STG / ORGID_STG not set');
}

if ($this->satusehat_env == 'PROD' && (empty($this->client_id) || empty($this->client_secret || empty($this->organization_id)))) {
if ($this->satusehat_env == 'PROD' && (empty($this->client_id) || empty($this->client_secret || empty($this->organization_id))) && !$this->override) {
throw new OAuth2ClientException('SATUSEHAT environment defined as PROD, but CLIENTID_PROD / CLIENTSECRET_PROD / ORGID_PROD not set');
}

Expand Down

0 comments on commit c08cc7c

Please sign in to comment.