Skip to content

Commit

Permalink
Merge pull request #18 from achmadhadikurnia/main
Browse files Browse the repository at this point in the history
Feature: Add config to disable http verify
  • Loading branch information
achmadhadikurnia authored Feb 21, 2024
2 parents c5c8136 + b669b0a commit 601413c
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 1 deletion.
13 changes: 13 additions & 0 deletions config/siasn-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,19 @@
|
*/

'http_verify' => (bool) env('SIASN_HTTP_VERIFY', true),

/*
|--------------------------------------------------------------------------
| Debug Mode
|--------------------------------------------------------------------------
|
| When in debug mode, detailed error messages with stack traces will be
| shown on every error that occurs within your application. If disabled,
| a simple generic error page is shown.
|
*/

'debug' => (bool) env('SIASN_DEBUG', env('APP_DEBUG')),

/*
Expand Down
1 change: 1 addition & 0 deletions src/Credentials/Apim.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public static function getToken(): Response

return Http::withOptions([
'debug' => Config::getDebug(),
'verify' => Config::getHttpVerify(),
])->withBasicAuth(
$credential->username,
$credential->password
Expand Down
1 change: 1 addition & 0 deletions src/Credentials/Sso.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public static function getToken(): Response

return Http::asForm()->withOptions([
'debug' => Config::getDebug(),
'verify' => Config::getHttpVerify(),
])->post($credential->url, [
'grant_type' => $credential->grant_type,
'client_id' => $credential->client_id,
Expand Down
10 changes: 9 additions & 1 deletion src/Helpers/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,21 @@ public static function isTraining(): bool
}

/**
* Get mode.
* Get debug.
*/
public static function getDebug(): bool
{
return config('siasn-api.debug');
}

/**
* Get http verify.
*/
public static function getHttpVerify(): bool
{
return config('siasn-api.http_verify');
}

/**
* Get Apim configuration.
*/
Expand Down
1 change: 1 addition & 0 deletions src/Siasn.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public function __construct()
->timeout(config('siasn-api.timeout'))
->withOptions([
'debug' => Config::getDebug(),
'verify' => false,
])->withToken(
$apimToken->access_token
);
Expand Down

0 comments on commit 601413c

Please sign in to comment.