diff --git a/config/ignition.php b/config/ignition.php index 4cc53e45..0190418c 100644 --- a/config/ignition.php +++ b/config/ignition.php @@ -211,4 +211,16 @@ 'settings_file_path' => '', + 'should_record' => env( + 'IGNITION_RECORD', + env('APP_DEBUG', true) && env('APP_ENV', 'local') != 'production' + ), + + 'recorders' => [ + 'jobs' => env('IGNITION_RECORD_JOBS', true), + 'dumps' => env('IGNITION_RECORD_DUMPS', true), + 'logs' => env('IGNITION_RECORD_LOGS', true), + 'queries' => env('IGNITION_RECORD_QUERIES', true) + ] + ]; diff --git a/src/IgnitionServiceProvider.php b/src/IgnitionServiceProvider.php index b0c305e5..db53e425 100644 --- a/src/IgnitionServiceProvider.php +++ b/src/IgnitionServiceProvider.php @@ -244,15 +244,24 @@ protected function registerLogHandler(): void protected function startRecorders(): void { - // TODO: Ignition feature toggles - - $this->app->make(DumpRecorder::class)->start(); - - $this->app->make(LogRecorder::class)->start(); - - $this->app->make(QueryRecorder::class)->start(); - - $this->app->make(JobRecorder::class)->start(); + if ($this->app->config['ignition.should_record']) { + + if ($this->app->config['ignition.recorders.dumps']) { + $this->app->make(DumpRecorder::class)->start(); + } + + if ($this->app->config['ignition.recorders.logs']) { + $this->app->make(LogRecorder::class)->start(); + } + + if ($this->app->config['ignition.recorders.queries']) { + $this->app->make(QueryRecorder::class)->start(); + } + + if ($this->app->config['ignition.recorders.jobs']) { + $this->app->make(JobRecorder::class)->start(); + } + } } protected function configureQueue(): void