Skip to content

Commit bf3d10b

Browse files
committed
refactor(horizon): use config for allowed emails and update gate definition
1 parent 8a5ada1 commit bf3d10b

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

app/Providers/HorizonServiceProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ protected function gate(): void
3030
Gate::define('viewHorizon', static function (User $user) {
3131
return in_array(
3232
needle: $user->email,
33-
haystack: explode(',', env('HORIZON_ALLOWED_EMAILS')),
33+
haystack: explode(',', (string) config('horizon.allowed_emails')),
3434
strict: true
3535
);
3636
});

config/horizon.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,18 @@
44

55
return [
66

7+
/*
8+
|--------------------------------------------------------------------------
9+
| Allowed Emails
10+
|--------------------------------------------------------------------------
11+
|
12+
| A comma-separated list of email addresses that are allowed to access
13+
| the Horizon dashboard in non-local environments.
14+
|
15+
*/
16+
17+
'allowed_emails' => env('HORIZON_ALLOWED_EMAILS', ''),
18+
719
/*
820
|--------------------------------------------------------------------------
921
| Horizon Name

0 commit comments

Comments
 (0)