Closed S-R0 closed 3 years ago
If you see @ray('something')
in the browser, that means that the ray package isn't installed at all. When the package isn't installed, the directive isn't recognised and the directive is being regarded as just text that should be output.
This line should make sure that, when the package is installed, that on production environments Ray is disabled.
Could you create a minimal app for me where the environment is set to production, and you're still seeing things being transmitted to Ray?
Apologies, potentially a caching issue, I am no longer seeing @ray('something')
in the browser, but I am still experiencing the issues with ray still reporting even with APP_ENV=production
in my .env
file.
As an example, I have added the following to one of my views
@ray("app()->environment('production') = " . app()->environment('production'))
and ray is showing
app()->environment('production') = 1
So it can see that the .env
file is set to production, but I am still getting that report/output to Ray.
Please create a minimal app for us to easily recreate the issue.
https://github.com/S-R0/laravel-ray-production-test
As you can see its a basic starting laravel project, no ray.php
file, but .env
has APP_ENV=production
and DEBUG_MODE=false
.
I have added 2 ray commands (1 to routes and 1 to the view) and both are still being reported in my local ray app.
Just out of curiosity, is this how ray is supposed to act? Even if you have APP_ENV=production
, it still reports if there is an instance of ray running on 127.0.0.1:23517
?
Thanks for that app. Using it, I could find a good fix.
Upgrade spatie/ray
to v1.20.1 to get the right behaviour.
Describe the bug Ray is enabled on production environment if
ray.php
file is not present.Versions Ray - 1.12.0 spatie/ray package version: 1.19.4 spatie/laravel-ray package version (if applicable): 1.12.6
PHP version: Laravel version (if applicable): 7.4
To Reproduce Steps to reproduce the behavior:
ray.php
file or rename it to something likeray.php.bak
.APP_ENV=production
andAPP_DEBUG=false
to your.env
file.@ray('something')
to one of your views.Expected behavior If no
ray.php
file is present (gitignored) but ray package is still installed, ray should not report. In my situation I have set an update onto a staging version of one of my sites, which does not have aray.php
file (as its included in.gitignore
) but does have ray package installed. The side was physically showing@ray('something')
on the frontend as text. Decided to test this locally with Ray open and with the above steps, ray is still reporting even though i've removed my ray.php file and even set the app to production.Additional context The only was I seem to be able to disable ray running and have nothing show in the view, is if I have a
ray.php
file present and haveRAY_ENABLED=false
in either theray.php
or.env
file.I think behaviour of this feature should be as follow
ray.php
file present,RAY_ENABLED=false
orAPP_ENV=production
in your.env
file, there should be no signs of ray running at all (this includes ray not showing in blade views)