You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When overriding a config value, for instance setting CONFIG__DEFAULT__WEB__SECURE__BASE_URL to override web/secure/base_url, the env variable value is loaded as expected and stored in cache.
However, Magento does not re-read environment variables values when already cached, making it impossible to define custom values for env variables at runtime, which may be very useful for CLI commands.
Expected behavior (*)
When getting a config by path, its value should systematically be checked in environment variables, before trying to get it from the cached config.
Exemple with config cache enabled:
export CONFIG__DEFAULT__WEB__SECURE__BASE_URL=http://localhost:8080
bin/magento cache:clean
# At this point, ScopeConfigInterface::getValue('web/secure/base_url') === 'http://localhost:8080', which works as expected
CONFIG__DEFAULT__WEB__SECURE__BASE_URL=http://localhost:8081 bin/magento my:command
# At this point, the "my:command" console command still reads the previous config value, the env variable override does not apply
Benefits
Being able to change config values at runtime without requiring to clear the cache.
Additional information
This is basically how Symfony and most frameworks behave when using environment variables.
The text was updated successfully, but these errors were encountered:
Hi @michael-bouvy. Thank you for your report.
To speed up processing of this issue, make sure that you provided the following information:
Summary of the issue
Information on your environment
Steps to reproduce
Expected and actual results
Make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:
@magento give me 2.4-develop instance - upcoming 2.4.x release
⚠️ According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.
📞 The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket.
✏️ Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel
Description (*)
Magento allows overriding configuration values using environment variables : https://devdocs.magento.com/guides/v2.4/config-guide/deployment/pipeline/example/environment-variables.html
When overriding a config value, for instance setting
CONFIG__DEFAULT__WEB__SECURE__BASE_URL
to overrideweb/secure/base_url
, the env variable value is loaded as expected and stored in cache.However, Magento does not re-read environment variables values when already cached, making it impossible to define custom values for env variables at runtime, which may be very useful for CLI commands.
Expected behavior (*)
When getting a config by path, its value should systematically be checked in environment variables, before trying to get it from the cached config.
Exemple with config cache enabled:
Benefits
Being able to change config values at runtime without requiring to clear the cache.
Additional information
This is basically how Symfony and most frameworks behave when using environment variables.
The text was updated successfully, but these errors were encountered: