-
Notifications
You must be signed in to change notification settings - Fork 11k
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
App::environment() ignores APP_ENV when --env option is used on cli #28854
Comments
I was able to reproduce it |
I can't test this atm because my tinker environment is still broken after bobthecow/psysh#540 so it would be cool if some more people could verify this. |
I can reproduce
It seems like this is expected functionality (see Illuminate\Foundation\EnvironmentDetector) but perhaps there should be different flags for the .env file and the value of APP_ENV? |
I think that will be a good solution. |
#28668 related a bit |
Going to close this as we don't consider this a bug. Please see the remark by Taylor here: #28982 (comment) |
Description:
The documentation says that "The current application environment is determined via the APP_ENV variable from your .env file.". It also says that "The current application environment detection can be overridden by a server-level APP_ENV environment variable."
However, when using artisan with the
--env
option,App::environment()
will return the value of the--env
option. To me as a developer, I find it logical that the--env
option is used to determine the.env
file to use, not to overrule the environment. After all, the name of the.env
file can differ from theAPP_ENV
value in that file.Steps To Reproduce:
.env
file to.env.foo
;APP_ENV
within.env.foo
tobar
;php artisan tinker
;App::environment()
, the value ofAPP_ENV
should be returned;php artisan tinker --env=foo
;App::environment()
;foo
is now returned, instead ofbar
.The text was updated successfully, but these errors were encountered: