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

Add Ability to Configure Local Domains in Clockwork Settings #699

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 4 additions & 2 deletions Clockwork/Request/IncomingRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,10 @@ public function hasLocalHost()
{
$segments = explode('.', $this->host);
$tld = $segments[count($segments) - 1];
$local_domains = config('clockwork.local_domains') ?? ['localhost', 'locl', 'local', 'test', 'wip'];

return $this->host == '127.0.0.1' ||
in_array($tld, $local_domains);

return $this->host == '127.0.0.1'
|| in_array($tld, [ 'localhost', 'local', 'test', 'wip' ]);
}
}
12 changes: 12 additions & 0 deletions Clockwork/Support/Laravel/config/clockwork.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,18 @@

'enable' => env('CLOCKWORK_ENABLE', null),

/*
|------------------------------------------------------------------------------------------------------------------
| Local Domains
|------------------------------------------------------------------------------------------------------------------
|
| Here you can specify the domains that Clockwork considers as "local". Clockwork will only run on these domains
| unless explicitly enabled.
|
*/

'local_domains' => ['localhost', 'locl', 'local', 'test', 'wip'],

/*
|------------------------------------------------------------------------------------------------------------------
| Features
Expand Down