Problem/Motivation
When adding Cloudflare Purge to Install Profile, installation fails. This did not happen on any version of 2.0.X Cloudflare purge
Drupal\Core\Config\PreExistingConfigException: Configuration objects (cloudflare_purge.settings) provided by cloudflare_purge already exist in active configuration in Drupal\Core\Config\PreExistingConfigException::create() (line 65 of /var/www/docroot/core/lib/Drupal/Core/Config/PreExistingConfigException.php).
Steps to reproduce
Add cloudflare_purge into your install_profile name.info.yml file and run the installation from website or command line.
Proposed resolution
I don't have a proposed solution but seems like something in the install script is causing the issue, and it's not checking that the data is already there from the config/install yml files.
Comments
Comment #2
flashwebcenterThank you for reporting this issue.
Installation failed with PreExistingConfigException because Cloudflare Purge originally shipped default config in config/install/. When the module was added as a dependency in an install profile, that same config could already exist from the profile, so Drupal refused to install it again.
Default config was moved from config/install/ to config/optional/.
cloudflare_purge.settings is now only installed if it does not already exist, which prevents conflicts with profile-provided config.
hook_install() now only fills in missing NULL keys instead of overwriting existing values.
This means standalone installs still get full defaults, while profile-based installs keep their existing config and only receive newly missing keys.
With this change, adding Cloudflare Purge as an install profile dependency should no longer trigger PreExistingConfigException.
Please test the latest dev release with your profile. If it still fails, share the exact error and install steps.
Best wishes,
Alaa
Comment #3
flashwebcenterComment #5
eric.guerin@ucsf.edu commentedAwesome, thank you!