Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed OAuthClient.php #46

Merged
merged 1 commit into from
Apr 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading