-
Notifications
You must be signed in to change notification settings - Fork 477
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
Sail does not read changes in .env file #658
Comments
Are all changes not reflected or just the APP_ENV? Reason I ask is because I don't feel changing APP_ENV is a realistic example. You usually just define that one time for local dev and that's it. |
Okay, its propably only the But: Why cant I expect that form the Also why does it work when running Do you have any idea where this might be / or not be documented? The issue I had required setting |
I just think changing your APP_ENV isn't a realistic use case and probably something that almost never happens. I'm sorry you got caught by this but I think for such an edge case, it's not worth updating the docs. You should also never use |
"I just think changing your APP_ENV isn't a realistic use case " I would strongly argue against that, for testing you will always want to do this, especially if you want to develop a behaviour based off the value and or you need to test things depending on it. Given there is a value in |
Found this after "artisan clearing" everything multiple times and scratching my head a bit. Just for the sake of conversation , I add my use case : I set Password rules based on ENV (I don't want to have constraints when developing/testing) but sometimes I need to use it. So, now I know that if I want to test it I need to down->up sail, but I would have never thought it was related to this. |
Also got caught out by this, so it's clearly not such a small edge case. |
Same "problem" here, after debugged the application sourcing of the .env file and were still confused why the environment did not change. |
@driesvints I was also caught by this bug, and I would highly encourage you/the team to update the docs.
I think it's worth updating the docs with this behavior. There are cases where someone may want to simulate production locally. |
Sail Version
1.27.2
Laravel Version
10.42.0
PHP Version
8.1
Operating System
Windows (WSL)
OS Version
10.0.19045 Build 19045
Description
If I start sail with
sail up
the.env
file is read and applied (cached?).The Problem: Subsequent changes are not beeing reflected, If I e.g. change from
APP_ENV=local
toAPP_ENV=production
that does not work.Workaround 1: You can run
sail artisan config:cache
which then reads from the.env
file again and the changes are reflected. This is not advised for local developmentWorkaround 2: Restart sail
I searched the documentation for hints of
.env
related issues, but found nothing besides that if you add sail services you will need to reflect the changes back to the.env
file.I originially tried finding why my Laravel Nova gate did not work, but it branches if installed locally and does not call the gate, I changed to
APP_ENV=production
but nothing happened. Searching for a solution I saw some of propably related questions and issues on StackoverflowSteps To Reproduce
Start sail by
sail up
Make changes to
.env
file (e.g.APP_ENV=production
)Nothing happens
The text was updated successfully, but these errors were encountered: