Skip to content
Menu
Open World News Open World News
  • Privacy Policy
Open World News Open World News

Specbee: How to split configurations across different sites in Drupal 10

Posted on August 6, 2024 by Michael G

Author:
Source

Configuration management is one of the best features introduced in Drupal. It allows developers to easily push configuration changes from development to staging, and finally to production environments. However, some configurations are environment-specific. For instance, modules like Devel, Kint, Views UI, and Google Tag are only enabled in development environments and not in production.
Fortunately, the Configuration Split module offers a solution by storing configurations in a separate directory, allowing for environment-specific imports. In this article, you’ll learn how to split configurations across different websites using this powerful Drupal 10 module.

Setup and using the Configuration Split module
Installing the Drupal Configuration Split module is like installing any other contributed module. Use composer to install it since it automatically installs all the necessary dependencies. Open the terminal, within the project and enter the command.
$ composer require drupal/config_splitCreate the split configuration
Once installed and enabled, we can create one or more “splits” to keep our configuration file in a separate folder.

Go to Admin > Configuration > Development > Configuration Split Settings
Click Add Configuration Split Setting
Enter a Label
In the folder field, enter the folder name relative to the Docroot.
The path will specify the folder inside which the split configurations should be stored.

../config/dev_splitMake sure the machine name of your split is the same as the folder name.

You can keep the split active or inactive by default. These settings can be overridden by settings.php.

Choose the module you want to split. In our case – the Devel Module.

Since we are pushing the module to a separate config split folder, We have to partially split core.extension.yml file, which stores information about what modules must be installed on your site.

Click Save.
The config files of the selected module will also be sent to the same folder once you export the config split.
The module also enables users to select any particular config file to be split.

Activate a Split
Once the split is created, it needs to be activated to carry out a split. The Drupal 10 Configuration Split module does not provide a UI for this purpose, but instead, we can modify our settings.php file to activate the split:
$config[‘config_split.config_split.dev_split’][‘status’] = TRUE;Where, dev_split is the machine name of the split we created earlier.
Now, export your configuration using drush cex. You can see the config_split settings getting updated and the module getting removed from your core.extension file, along with respective settings files.
To export the configs selected in the dev_split, you have to run a different command, i.e.
drush config-split: export “split_name”In our case it would be, drush config-split:export dev_split.
Now you can see the files selected in dev_split getting exported to the dev_split directory. 

For our Development split, we need to have it activated in the development environment, but not in production. To do so, we add the following to our settings.php on our development environment.

$config[‘config_split.config_split.development’][‘status’] = TRUE;
For the Production site we won’t add this code in the settings file, or we can also disable it explicitly by using below code:

config[‘config_split.config_split.development’][‘status’] = FALSE;Activate split based on environment
You can also specify which split should be active in a certain environment by adding a condition in settings.php as shown below:
if (isset($_ENV[‘AH_SITE_ENVIRONMENT’])) {
   switch ($_ENV[‘AH_SITE_ENVIRONMENT’])
   {
     case ‘develop’:
    $config[‘config_split.config_split.dev_split’][‘status’] = TRUE;
    break;
     case ‘live’:
    $config[‘config_split.config_split.prod_split’][‘status’] = TRUE;
    break;
   }
 }The above code will activate dev_split in the development (‘develop’) environment and prod_split in the production (‘live’) environment.
Final Thoughts
The Configuration Split Module is a fantastic feature introduced in Drupal’s configuration management. By splitting up configurations based on environments, you can use the module only in certain environments, based on your needs. We hope you found this article helpful. For more interesting articles on Drupal and everything technology, please bookmark our blog and come back for more!

Read more

Related Posts:

  • Specbee: Mastering Drupal 9 Layout Builder: A Comprehensive Guide to Effortlessly Customize Your Website's Design
    Specbee: Mastering Drupal 9 Layout Builder: A…
  • Specbee: Getting Started with Layout Builder in Drupal 9 - A Complete Guide
    Specbee: Getting Started with Layout Builder in…
  • Specbee: How to Integrate Google Tag Manager with Drupal 9 – An Easy Step-by-Step Tutorial
    Specbee: How to Integrate Google Tag Manager with…
  • Specbee: Migrate to Drupal 9 (or 10) Without Losing Your Hard-Earned SEO Ranking
    Specbee: Migrate to Drupal 9 (or 10) Without Losing…
  • Specbee: The Ultimate Guide to Jumpstart your Drupal Contribution Journey
    Specbee: The Ultimate Guide to Jumpstart your Drupal…
  • Specbee: What You Need To Know About Continuous Integration and Testing in Drupal
    Specbee: What You Need To Know About Continuous…

Recent Posts

  • [TUT] LoRa & LoRaWAN – MikroTik wAP LR8 kit mit The Things Network verbinden [4K | DE]
  • Mercado aguarda Powell e olha Trump, dados e Haddad | MINUTO TOURO DE OURO – 11/02/25
  • Dan Levy Gets Candid About Learning How To Act Differently After Schitt’s Creek: ‘It’s Physically…
  • Building a Rock Shelter & Overnight Stay in Heavy Snow 🏕️⛰️
  • Les milliardaires Elon Musk et Xavier Niel s’insultent copieusement

Categories

  • Android
  • Linux
  • News
  • Open Source
©2025 Open World News | Powered by Superb Themes
We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept All”, you consent to the use of ALL the cookies. However, you may visit "Cookie Settings" to provide a controlled consent.
Cookie SettingsAccept All
Manage consent

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
CookieDurationDescription
cookielawinfo-checkbox-analytics11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".
cookielawinfo-checkbox-functional11 monthsThe cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".
cookielawinfo-checkbox-necessary11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".
cookielawinfo-checkbox-others11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.
cookielawinfo-checkbox-performance11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".
viewed_cookie_policy11 monthsThe cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data.
Functional
Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.
Performance
Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Analytics
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.
Advertisement
Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.
Others
Other uncategorized cookies are those that are being analyzed and have not been classified into a category as yet.
SAVE & ACCEPT