-
Notifications
You must be signed in to change notification settings - Fork 16
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
[TASK] set env variables based on $_SERVER #65
base: develop
Are you sure you want to change the base?
Conversation
@lewisvoncken - Do you have a bug or issue to support this change? It was several months ago I wrote this, and I do recall some debate went into Happy to discuss further if you could provide more context. |
The issue is when you don't use commerce cloud you have to also be able to set these variables and that could be done through putenv but these won't be returned when you use getenv because they are set through a local putenv in the index.php as you can see in the other PR. |
In my local environment, I've injected Venia environment variables into |
My setup is with nginx can you please test that also? |
Thank you, I am able to reproduce now. Appears we're running into the SAPI caveat when using Outside of this caveat, there should be no difference between Before committing to this change though, I'm going to research how our cloud handles environment variables, and see if that's an alternative to injecting via |
@lewisvoncken - Are you comfortable injecting variables via nginx config instead? This addition seems to work for me, and makes variables available with
|
@tjwiebell the reason I want to use $_SERVER variable is that you can fill the url with the HTTP_HOST so you eventually can start using multi domains but this can also be done in nginx but in my opinion that is extra unnecessary configuration because these can dynamically be set with the HTTP_HOST. This dynamic setter I have added in the other PR but can also be set in the upward-php lib or module through the $_SERVER variables. can be set as:
and then the getMagentoBackendUrl contains:
and the NODE_ENV has to still be set based on the mode which Magento is running in or else you have to configure that one twice because that variable is MAGE_MODE
What is the ideal situation? @dheesbeen |
@lewisvoncken - Magento core seems to have established that |
9dfd74b
to
2af1488
Compare
for the test the base url isn't used but mainly the UPWARD_PHP_UPWARD_PATH which is a global environment variable which can be set through several different ways but for the test it is possible to merge getenv into the $_SERVER variables. And for the url 127.0.0.1 is used If you have a better idea let me know. Thank you in advance. |
- Fix failing unit test
@lewisvoncken - Made some minor adjustments in 2672341 to get all tests passing and cleanup some logic, but this change looks good to me. The team goes through replenishment every Monday where we commit to our weekly delivery, so I'll get this added to our queue so it can be reviewed and QA'd. Thanks for your contribution. |
@tjwiebell do you have an update about the review of this pr? |
@tjwiebell and @zetlen |
Hi @lewisvoncken! Tommy has gone on parental leave, but he made sure to hand off these important tickets internally. I'm not the perfect one to review this as code, but I understand from the discussion that it's important to expedite. We'll make sure it falls into the right hands, and soon. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good from code point of view. Someone need to test.
To run PWA Studio through Upward there are 2 variables which need to be set and this is an alternative method compared to the getenv which can't be correctly updated with putenv because the local env variable is not available when calling getenv.
This PR is related to the magento 2.3 core PR magento/magento2#23126