Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot disable auto-discovery #60

Closed
denitsa-md opened this issue Aug 30, 2018 · 4 comments
Closed

Cannot disable auto-discovery #60

denitsa-md opened this issue Aug 30, 2018 · 4 comments
Assignees

Comments

@denitsa-md
Copy link

denitsa-md commented Aug 30, 2018

I want to disable auto-discovery and register the service provider manually since I don't want rollbar on development. I tried doing it but to no avail.

I read the docs here https://docs.rollbar.com/docs/laravel#section-installation.

I have the following entry in my composer.json

  "extra": {
    "laravel": {
      "dont-discover": [
        "rollbar/rollbar-laravel"
      ]
    }

I have the following in my AppServiceProvider:register():

        if ($this->app->environment(['staging', 'production'])) {
            $this->app->register(\Rollbar\Laravel\RollbarServiceProvider::class);
        }

I have version:

            "name": "rollbar/rollbar-laravel",
            "version": "v4.0.0",

I've also run php artisan package:discover after the update to composer.json and the package is correctly not present in Discovered package: lines that are generated from the command.

My temporary solution is to remove the ROLLBAR_TOKEN from my local .env file.

Is there something I'm missing?

@jessewgibbs
Copy link

Hi denitsa-cm,

We'll get one of our library maintainers to take a look at your question and respond soon.

@nickbryan
Copy link

@ArturMoczulski any update on this?

@kedarv
Copy link

kedarv commented Oct 6, 2018

This turned out to be an easy fix. The documentation just needs to be more explicit if you're copy pasting from the instructions. To resolve, just remove Rollbar\Laravel\RollbarServiceProvider::class, from your providers array in config/app.php

Then, conditionally load the provider in your AppServiceProvider.

As we can see here, Laravel will attempt to register every service provider in the array in config/app.php

Hope this helps!

@ArturMoczulski
Copy link

Great! Thanks @kedarv I'll amend the docs right now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants