Skip to content

Commit

Permalink
Improve enabled flag (#173)
Browse files Browse the repository at this point in the history
  • Loading branch information
timacdonald authored Dec 9, 2023
1 parent 4b424d8 commit 002e7ac
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions src/PulseServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,6 @@ public function register(): void
__DIR__.'/../config/pulse.php', 'pulse'
);

if (! $this->app->make('config')->get('pulse.enabled')) {
return;
}

$this->app->singleton(Pulse::class);
$this->app->bind(Storage::class, DatabaseStorage::class);

Expand All @@ -63,15 +59,15 @@ protected function registerIngest(): void
*/
public function boot(): void
{
if (! $this->app->make('config')->get('pulse.enabled')) {
return;
if ($enabled = $this->app->make('config')->get('pulse.enabled')) {
$this->app->make(Pulse::class)->register($this->app->make('config')->get('pulse.recorders'));
$this->listenForEvents();
} else {
$this->app->make(Pulse::class)->stopRecording();
}

$this->app->make(Pulse::class)->register($this->app->make('config')->get('pulse.recorders'));

$this->registerAuthorization();
$this->registerRoutes();
$this->listenForEvents();
$this->registerComponents();
$this->registerResources();
$this->registerPublishing();
Expand Down

0 comments on commit 002e7ac

Please sign in to comment.