-
-
Notifications
You must be signed in to change notification settings - Fork 188
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
custom sentry config #105
Comments
Hey @drmax24, Have you followed the readme? It states you can publish the config file using: php artisan vendor:publish --provider="Sentry\SentryLaravel\SentryLaravelServiceProvider" This will create a config file in You can always copy the config file from the vendor to |
We have config/sentry.php and always had. But it i felt like I'll check it again. |
Well if the message is coming through, you are definitly using your custom config (since otherwise the DSN is not loaded and events are not being transmitted to Sentry). |
Hey @drmax24 did you figure it out what was happening or are you still having difficulties? |
Closing this because of inactivity, please do re-open if the problem persists! |
I still have a problem. Laravel 5.1.* (Latest 5.1) Here is my config/sentry.php file:
But sentry only reads SENTRY_DSN from .env ignoring what i write in config/sentry.php |
This is a bug, perhaps, on your interpretation (imo it is - at minimum, it should be documented). It's due to the magic happening in the Raven_Client.php:
All the Laravel env variables are accessible via $_SERVER. So even though you have specifically set the dsn to '' when This is a particularly risky way to develop the client, I'm sure there is a reason for the client to pick up env variables - but explicit definition is often preferred. |
Actually, digging deeper - this is actually a bug-bug. Regardless of what you set in the sentry config, raven client will always use your env variables instead. Looking at the logic above, if you have an env var set, called SENTRY_DSN (which is typically read into the user config) it will always overwrite what is in config (which is essentially the $options array above) |
I still feel this is not a bug but a not so handy choice in this regard since we should have named our
I do see this is less than ideal for when you have a DSN in your I think this is more a documentation bug than an actual bug... however not sure how to move forward since it's a bad idea to change that fallback clause in the client and also a bad idea to do nothing at all. Maybe for new installs we should rename our recomendation for the What do you think? |
I do see what you are saying. I think most will set up their own config based on the given config from Sentry (via php artisan vendor:publish). I think the main problem is that the config is deceiving (as per my second comment) - in the sense, that it is ignored if you are using the per-instructions setup. To support backwards compatibility, I would be inclined to do the following:
Happy to do a PR (I only found this issue by accident, and decided to look into it deeper). I wouldn't be able to action a PR for about 5 days though. |
Yeah with the current .env var it is definitly not working as expected. Apart from the the README.md there is also a docs folder in Also we have a few examples that would be best to be updated as well. I think Happy to accept a PR for this! 👍 however I might do it before you, will update the issue if I start working on this since I might have some time earlier 😄 Thanks for digging! |
Great, I'll leave it to you in this case if you have available capacity. Thanks for looking into it! 😄 |
Awesome, good stuff @stayallive Cheers |
Hey Guys, If you update I strongly recommend to rename |
* Fallback to SENTRY_DSN if defined in env #136 #105 #130 * Fix broken config syntax Co-authored-by: Daniel Griesser <[email protected]> Co-authored-by: Alex Bouma <[email protected]>
We use sentry-laravel in our projects. However there is one problem.
We often call sentry like this:
app(‘sentry’)->captureMessage(’bla-bla', [], ['level' => 'warning']);
If called like this sentry reads configuration from file inside vendor dir.
We would like it to read our configuration file not yours.
/config/sentry.php would be ok
The text was updated successfully, but these errors were encountered: