Skip to content

Commit c7e7e5f

Browse files
authored
Merge pull request #55 from thomascombe/feat/custom-cron
Allow to disable and change cron to unlockip command
2 parents 601f3b4 + bdb3d33 commit c7e7e5f

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

.scrutinizer.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ tools:
1313
php_code_sniffer:
1414
config:
1515
standard: "PSR2"
16-
php_cpd: true
16+
php_cpd: false # PHP Copy/Paste Detector and PHP Code Similarity Analyzer cannot both be used simultaneously
1717
php_mess_detector: true
1818
php_pdepend: true
1919
sensiolabs_security_checker: true

src/Config/firewall.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212
// 'ip' => '\App\Models\YourIpModel',
1313
],
1414

15+
'unblockip_cron' => [
16+
'enabled' => boolval(env('FIREWALL_UNBLOCKIP_ENABLED', true)),
17+
'cron' => env('FIREWALL_UNBLOCKIP_CRON', '* * * * *'),
18+
],
1519
'responses' => [
1620

1721
'block' => [

src/Provider.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,12 @@ public function registerCommands()
106106
{
107107
$this->commands(UnblockIp::class);
108108

109-
$this->app->booted(function () {
110-
app(Schedule::class)->command('firewall:unblockip')->everyMinute();
111-
});
109+
if (config('firewall.unblockip_cron.enabled', true)) {
110+
$this->app->booted(function () {
111+
app(Schedule::class)
112+
->command('firewall:unblockip')
113+
->cron(config('firewall.unblockip_cron.cron', '* * * * *'));
114+
});
115+
}
112116
}
113117
}

0 commit comments

Comments
 (0)