spiral-modules / roadrunner-binary

💾 High-performance PHP application server, load-balancer and process manager written in Golang. RR2 releases repository.
MIT License
44 stars 25 forks source link

[BUG] .env handling broken in 2.0.4? #41

Closed taylorotwell closed 3 years ago

taylorotwell commented 3 years ago

Hello,

After 2.0.4 we are seeing our Laravel .env file variables persist forever in Laravel Octane powered applications. If we change variable in the Laravel .env file we do not see the variable updated even after reloading the RoadRunner workers - a full daemon restart is required.

I see 2.0.4 introduced some new .env functionality - we are not using that.

rustatian commented 3 years ago

Hello @taylorotwell , Recently we added .env files support to the RR2. The values are not updated because workers are forks and all .env variables are inherited from the parent. When you restart the PHP worker process, the root process still has its env's.

taylorotwell commented 3 years ago

Is there anyway to opt out of this to the old behavior?

rustatian commented 3 years ago

You can try to specify RR .env path as an empty string, like: --dotenv=""

rustatian commented 3 years ago

And also, do you use DOTENV_PATH env variable?

taylorotwell commented 3 years ago

Thanks - --dotenv="" works for us.

No - I don't use DOTENV_PATH.

rustatian commented 3 years ago

Thanks - --dotenv="" works for us.

Great 👍🏻

rustatian commented 3 years ago

@taylorotwell Feel free to close the issue then or is there something else I can help you with?

rustatian commented 3 years ago

@48d90782 Update default value here: https://github.com/spiral/roadrunner-binary/blob/master/internal/cli/root.go#L87, use just empty string. To turn on this feature user should explicitly use the --dotenv flag.

rustatian commented 3 years ago

@taylorotwell Feel free to try nightly builds from here without --dotenv: https://github.com/spiral/roadrunner-binary/actions/runs/765151263 In the upcoming 2.0.5 you can remove the --dontenv flag, by default it will refer to the empty string.