Skip to content

Commit

Permalink
Refactor siteverify to config file
Browse files Browse the repository at this point in the history
  • Loading branch information
njoguamos committed Feb 11, 2024
1 parent 1f240e6 commit bf8f691
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
16 changes: 14 additions & 2 deletions config/turnstile.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
| when testing your application. Disabling ensure your tests runs
| smoothly. remember to enable once you are done testing.
|
|
*/
'enabled' => env(key: 'TURNSTILE_ENABLED', default: true),

Expand All @@ -38,7 +37,20 @@
| application. Failure to include the field in the request will cause
| a runtime exception. This is precautionary measure.
|
|
*/
'field' => env(key: 'TURNSTILE_FIELD', default: 'cf-turnstile-response'),

/*
|--------------------------------------------------------------------------
| Turnstile Site Verify Url
|--------------------------------------------------------------------------
|
| This is the cloudflare endpoint that is used to verify the turnstile
| token. You must must call the siteverify endpoint to validate the
| Turnstile widget response
|
| Learn more: https://developers.cloudflare.com/turnstile/get-started/server-side-validation/
|
*/
'url' => env(key: 'TURNSTILE_URL', default: 'https://challenges.cloudflare.com/turnstile/v0/siteverify'),
];
2 changes: 1 addition & 1 deletion src/Turnstile.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Turnstile

public function __construct()
{
$this->url = 'https://challenges.cloudflare.com/turnstile/v0/siteverify';
$this->url = config(key: 'turnstile.url');

$this->secretKey = config(key: 'turnstile.secretkey');

Expand Down

0 comments on commit bf8f691

Please sign in to comment.