Skip to content

Commit a661a70

Browse files
tobz-nzArturMoczulski
authored andcommitted
Stop boot/registration if $level == ‘none’
This will helps prevent errors during a first deploy in some cases(e.g.: if the .env file has not been setup until later in the process).
1 parent 8773168 commit a661a70

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/RollbarServiceProvider.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class RollbarServiceProvider extends ServiceProvider
2020
public function boot()
2121
{
2222
// Don't boot rollbar if it is not configured.
23-
if ($this->stopRegistration() === true) {
23+
if ($this->stop() === true) {
2424
return;
2525
}
2626

@@ -51,7 +51,7 @@ public function boot()
5151
public function register()
5252
{
5353
// Don't register rollbar if it is not configured.
54-
if ($this->stopRegistration() === true) {
54+
if ($this->stop() === true) {
5555
return;
5656
}
5757

@@ -88,11 +88,12 @@ public function register()
8888
*
8989
* @return boolean
9090
*/
91-
public function stopRegistration()
91+
public function stop()
9292
{
93+
$level = strtolower(getenv('ROLLBAR_LEVEL'));
9394
$hasToken = !empty(getenv('ROLLBAR_TOKEN'));
9495
$hasConfig = $this->app['config']->has('services.rollbar');
9596

96-
return $hasToken === false && $hasConfig === false;
97+
return $level == 'none' || $hasToken === false && $hasConfig === false;
9798
}
9899
}

0 commit comments

Comments
 (0)