magento / magento/magento2

Apply `MAGENTO_DC` overrides to nested deployment configuration

Open
#41,206 3 comments 0 reactions 1 assignee View on GitHub

@monteshot is already working on this.

Since Sep 2, 2026.

Issue: ready for confirmation Reported on 2.4.6-p12 Triage: Dev.Experience
Dominant language
PHP
Stars
12.2k
Forks
9.4k
PR merge metrics
No merged PRs in 30d

Description

### Preconditions and environment

- Magento version - Latest (but also tested on 2.4.6-p12)

Fix available in https://github.com/magento/magento2/pull/41201

### Steps to reproduce

1. Start with an installed Magento instance whose `app/etc/env.php` contains a database connection with values different from the environment variables below.
2. Export conventional deployment configuration overrides:

```bash
export MAGENTO_DC_DB__CONNECTION__DEFAULT__HOST=db
export MAGENTO_DC_DB__CONNECTION__DEFAULT__DBNAME=magento
export MAGENTO_DC_DB__CONNECTION__DEFAULT__USERNAME=magento
export MAGENTO_DC_DB__CONNECTION__DEFAULT__PASSWORD=magento
export MAGENTO_DC_DB__CONNECTION__DEFAULT__ACTIVE=1
export MAGENTO_DC_DB__CONNECTION__DEFAULT__MODEL=mysql4
export MAGENTO_DC_DB__CONNECTION__DEFAULT__ENGINE=innodb
export MAGENTO_DC_DB__CONNECTION__DEFAULT__DRIVER_OPTIONS__1014=false
```

3. Read both the parent connection configuration and representative leaf values:

```bash
php -r 'require "app/bootstrap.php"; $bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $_SERVER); $config = $bootstrap->getObjectManager()->get(\Magento\Framework\App\DeploymentConfig::class); var_export(["parent" => $config->get("db/connection/default"), "host" => $config->get("db/connection/default/host"), "driver_option" => $config->get("db/connection/default/driver_options/1014")]);'
```

4. Verify that `parent.host` and the leaf `host` both equal `db`, the remaining parent values match the exported variables, and `parent.driver_options[1014]` and `driver_option` are boolean `false`.
5. Remove the exported variables after testing.

Before this change, the leaf values reflect the environment while the parent array retains values from `app/etc/env.php`. After this change, both representations are consistent.

### Expected result

Nested deployment configuration is not applied correctly

### Actual result

Nested deployment configuration is applied correctly

### Additional information

Fixing this issue helps to more finely manage the Magento 2 application by moving away from a monolithic approach to managing/using the infrastructure.

https://experienceleague.adobe.com/en/docs/commerce-operations/configuration-guide/deployment/examples/example-environment-variables

\Magento\Config\App\Config\Source\EnvironmentConfigSource::get
\Magento\Framework\App\DeploymentConfig::get

### Release note

_No response_

### Triage and priority

- [ ] Severity: **S0** _- Affects critical data or functionality and leaves users without workaround._
- [x] 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”._

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.