Unable to override nested properties in config yml and settings.php at the same time

Created on 16 May 2021, about 3 years ago
Updated 8 January 2024, 6 months ago

Drupal Version

Drupal 8

Domain module version

8.x-1.x

Expected Behavior

When overriding nested config properties within both settings.php and domain.config yml files, i'd expect for these values to be merged.

Actual Behavior

The settings.php config completely overrides the domain.config config essentially ignoring the DB domain config.

Steps to reproduce

Override domain config within your DB/YML files (domain.config.DOMAIN.CONFIG_NAME.yml)

setting_one: hello
setting_two: world

In your settings.php file override one of the properties:

  $config["domain.config.DOMAIN.CONFIG_NAME"]['setting_two'] = 'new value';

The resulting domain config overrides will be only:

setting_two: new_value

Attaching a patch to resolve this issue, but not sure if this is causing a breaking change for anyone which relies on the complete override of all config within settings.php even though this doesn't seem like the expected behavior.

πŸ› Bug report
Status

Needs work

Version

1.0

Component

Code

Created by

πŸ‡¬πŸ‡§United Kingdom ocastle

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡¦Ukraine skrasulevskiy

    Hello,
    I attached the updated patch, because this one is not applied https://www.drupal.org/project/domain/issues/3214209#comment-14104529 πŸ› Unable to override nested properties in config yml and settings.php at the same time Needs work

  • πŸ‡ΊπŸ‡ΈUnited States agentrickard Georgia (US)

    Still needs a test.

    If you look at DomainConfigOverriderTest, you will see two methods testDomainConfigOverrider() and testDomainConfigOverriderFromSettings()

    We need a new test that combines these, loading config from testDomainConfigOverrider() and also introducing soemthing from settings. But to actually test what you want, we also need to add another variable under test.

    Adding system.site.slogan seems like an easy addition. Set that in settings and name in config and then ensure the values are merged.

Production build 0.69.0 2024