app/etc/env.php
needs write permission and is rewritten on deployment
#37380
Labels
Issue: ready for confirmation
Reported on 2.4.x
Indicates original Magento version for the Issue report.
Triage: Dev.Experience
Issue related to Developer Experience and needs help with Triage to Confirm or Reject it
Summary
I'm deploying Magento using prebuilt container images.
The one thing that I can't really understand why it is design this way, it is rewriting
app/etc/env.php
even when it is told to keep-generated, expected by documentation to respect deployments on multiple server/instances.Also, beside changing other stuff in
app/etc/env.php
, it also replaces with values from environment variables all calls likegetenv('DB_HOST')
to returned value.I find it an anti 12 App Factor pattern writing to
app/etc/env.php
, principal to what the docs say that Magento is respecting (so it is a proof that 12 App Factor is not respected?)Examples
If
app/etc/env.php
hasgetenv('DB_HOST')
, it will be replaced withreal_value_from_environment_variable
, the file being overwritten.Proposed solution
If
app/etc/env.php
containsgetenv('XXX')
it should not replace it with the calculated value.app/etc/env.php
should never be rewritten and deployment should expose required changes so "ops" can put the configuration and redeploy.This should be at least optional and usable by some parameters to
setup:upgrade
to allow protected environments to haveapp/etc/env.php
read-only, and also should be the case forapp/etc/config.php
, this one expected to be writable only in a development environment and never in production.Release note
No response
Triage and priority
The text was updated successfully, but these errors were encountered: