Alter of config.installer service fails if extension has no config/install directory

Created on 26 June 2021, almost 4 years ago
Updated 6 March 2025, 27 days ago

Problem/Motivation

We currently alter the config.installer service to swap in a custom class and so override the protected ::getConfigToInstall() method.

The pattern here is used for example by the Configuration Share β†’ module, which:

enables commonly needed configuration items to be shared among multiple features and distributions.

Using Configuration Share, when a configuration item in config/install has a config dependency that's not already present on a site, the dependency will be added if found in a config/shared directory of any installed module.

However as pointed out by gambry in ✨ Provide tests coverage Active :

Providers are not called, unless a module has got a "config/install" folder, since ConfigInstaller::installDefaultConfig() skips the block where getConfigToCreate() is called unless a "config/install" folder exists in the module being processed.

The pattern just happens to work for Configuration Share because there is always a config/install directory in the providing extension, but will fail with other types or providers. For example, configuration provided by the config_provider_foo_consumer_test module will show up in available configuration updates via Configuration Synchronizer, but presumably will not be installed when the module is installed because the module lacks a config/install directory.

Steps to reproduce

Proposed resolution

Options include:

  • Provide developer documentation that notes the need for a config/install directory in order for configuration providers to work.
  • Instead of altering the service and swapping out its class, decorate it and swap out the public ::installDefaultConfig() method, calling our code without the condition of config/install existing.

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Active

Version

2.0

Component

Code

Created by

πŸ‡¨πŸ‡¦Canada nedjo

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.

Production build 0.71.5 2024