From c08cc7ca8c190a52faf2fab27ccde4883266d11a Mon Sep 17 00:00:00 2001 From: ivanwilliammd Date: Wed, 10 Apr 2024 10:57:25 +0700 Subject: [PATCH] fixed OAuthClient.php --- src/OAuth2Client.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/OAuth2Client.php b/src/OAuth2Client.php index 3e56f83..c4ff9e9 100644 --- a/src/OAuth2Client.php +++ b/src/OAuth2Client.php @@ -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'); }