Drupal is a registered trademark of Dries Buytaert
Protected Pages 3.0.0 Major update available for module protected_pages (3.0.0). Commerce Core 3.3.8 Minor update available for module commerce (3.3.8). Search API HTML Element Filter 1.0.7 Minor update available for module search_api_html_element_filter (1.0.7). Layout Builder Reorder 2.0.1 Minor update available for module layout_builder_reorder (2.0.1). Ban 1.1.0 Minor update available for module ban (1.1.0). Field Formatter Range 2.0.0 Major update available for module field_formatter_range (2.0.0). Field Formatter Range 8.x-1.8 Minor update available for module field_formatter_range (8.x-1.8). Varbase Media Header 9.2.1 Minor update available for module varbase_media_header (9.2.1). Search API Solr 4.3.11 Module search_api_solr updated after 14 months of inactivity (4.3.11). Provus Mega Menu Module provus_mega_menu crossed 1,000 active installs.

Config Patch

375 sites Security covered
View on drupal.org

This module helps manage configuration changes made directly on a live site by allowing you to create patches for those differences. These patches can then be committed back to your code repository, ensuring your configuration stays in sync. It integrates with various code hosting services like GitHub and GitLab for easier collaboration.

With strict configuration management, config always moves from development to production as part of an automated deployment process. But this ideal can fall apart quickly in the real world. If a sitebuilder makes a quick configuration change on production, how do we make sure this change is propagated back to the source repository and not overwritten by the next deployment?

This module provides a framework for creating and applying patches for config (the differences between active configuration and sync configuration). This allows sitebuilders to make changes to configuration in the UI and push a button to create a patch which may then be committed back to source. The framework is extensible, so additional output plugins may provide integrations with e.g., cloud source control providers. For instance, submodules listed below can be used to create PRs on Github or MRs on Gitlab.

Since patches reference config yml file paths, the base path of these files is configurable. If your synchronized config is stored in drupal/config in your source repo, you might configure drupal/config as your base config path in config_patch. If on the other hand, your various repositories and environments all follow the same Drupal path structure, insert something like the following into settings.php for zero module configuration:

$config['config_patch.settings']['config_base_path'] = 'web/' . $settings['config_sync_directory'];

(below where config_sync directory has been defined).

When installed, config_patch provides an additional tab Patch on the admin config synchronization pages listing config that's out of sync and providing a button to output the patch in various forms. The action of the button is controlled by the currently selected output plugin.

A helpful widget will also appear in the toolbar revealing the number of config items differing between sync and active storage. Clicking the widget will take you to the config sync Patch tab.

Available output plugins

  • Text: (included with config_patch) provides text output of a unified diff patch
  • Gitlab: provides submission to Gitlab repositories using MR-by-email functionality.
  • Gitlab API: create an MR in Gitlab directly using their API
  • Gitea: create an PR on Gitea
  • Azure API: push config to any Azure instance by using the Azure DevOps API.
  • Github API: create a PR on Github

Similar modules

  • Config Partial Export: export a tarball of config ymls that differ between sync and active
  • Config PR: very similar to this module; make a PR in Github, Gitlab, or Bitbucket based on a config patchset

Works with

  • Config Ignore: config_patch will respect config_ignore settings

Drush integration

drush config:patch PLUGIN_ID  # create a patch via a plugin
drush config:patch:list       # list files that have changed

If you have a drush alias (or similar way to run drush on a remote site), you can easily apply config changes from that site to your local repo:

drush cpatch text|patch -p1

Activity

Total releases
3
First release
Feb 2025
Latest release
1 year ago
Releases (12 mo)
0 ▼ from 3
Maintenance
Dormant

Release Timeline

Releases

Version Type Release date
3.0.6 Stable Jun 23, 2025
3.0.5 Stable Feb 25, 2025
3.0.4 Stable Feb 17, 2025