From 47e5fed30ec3724a375e3778730fdc7dad531039 Mon Sep 17 00:00:00 2001 From: Mathias Hansen Date: Mon, 5 Feb 2024 10:20:02 +0100 Subject: [PATCH 1/2] fix: Don't instantiate Redis connection if Wafris is disabled --- src/WafrisServiceProvider.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/WafrisServiceProvider.php b/src/WafrisServiceProvider.php index fa8026a..d88461f 100644 --- a/src/WafrisServiceProvider.php +++ b/src/WafrisServiceProvider.php @@ -12,8 +12,11 @@ class WafrisServiceProvider extends PackageServiceProvider public function register(): void { parent::register(); - $this->app->singleton(Core::class, function (Application $app) { + if (! config('wafris.enabled')) { + return null; + } + $redis = Redis::connection(config('wafris.redis_connection')); $core = new Core($redis); $core->load(); From ed96f369d2acb5d20977dae365b64012ff3f19fd Mon Sep 17 00:00:00 2001 From: MiniCodeMonkey Date: Mon, 5 Feb 2024 09:20:33 +0000 Subject: [PATCH 2/2] Fix styling --- src/WafrisServiceProvider.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/WafrisServiceProvider.php b/src/WafrisServiceProvider.php index d88461f..632b755 100644 --- a/src/WafrisServiceProvider.php +++ b/src/WafrisServiceProvider.php @@ -16,7 +16,7 @@ public function register(): void if (! config('wafris.enabled')) { return null; } - + $redis = Redis::connection(config('wafris.redis_connection')); $core = new Core($redis); $core->load();