Skip to content

app/etc/env.php needs write permission and is rewritten on deployment #37380

Closed
@madalinignisca

Description

@madalinignisca

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 like getenv('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 has getenv('DB_HOST'), it will be replaced with real_value_from_environment_variable, the file being overwritten.

Proposed solution

If app/etc/env.php contains getenv('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 have app/etc/env.php read-only, and also should be the case for app/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

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue: ready for confirmationReported on 2.4.xIndicates original Magento version for the Issue report.Triage: Dev.ExperienceIssue related to Developer Experience and needs help with Triage to Confirm or Reject it

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions