Skip to content

Commit

Permalink
Thow exception if token is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
jenssegers committed Mar 20, 2016
1 parent 8c64294 commit 24d5b72
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/RollbarServiceProvider.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php namespace Jenssegers\Rollbar;

use Illuminate\Support\ServiceProvider;
use InvalidArgumentException;
use Rollbar;
use RollbarNotifier;

Expand Down Expand Up @@ -49,6 +50,10 @@ public function register()

$config['access_token'] = getenv('ROLLBAR_TOKEN') ?: $app['config']->get('services.rollbar.access_token');

if (empty($config['access_token'])) {
throw new InvalidArgumentException('Rollbar access token not configured');
}

Rollbar::$instance = $rollbar = new RollbarNotifier($config);

return $rollbar;
Expand Down

1 comment on commit 24d5b72

@alariva
Copy link

@alariva alariva commented on 24d5b72 Apr 27, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a suggested way to configure no ACCESS_TOKEN for testing/continuous integration environments?

I'm currently adding this to register() at AppServiceProvider.php

    if ($this->app->environment() != 'testing') {
        $this->app->register(Jenssegers\Rollbar\RollbarServiceProvider::class);
    }

But unsure about if it's the best way.

Please sign in to comment.