Configuration Split in Drupal

13 / Jan / 2023 by sunidhi.negi 0 comments


Drupal has recently introduced one of its greatest features i.e., configuration management. For instance, you need a stage file proxy module on your local, dev and stage environments but not on a production environment. This is where the configuration split module comes into the picture. It helps users to split/divide configurations for different environments. It is supported by Drupal 8 as well as Drupal 9. In this article, we will learn more about its setup and use of config split module.

Installing and configuring the Config Split Module

  • Install the module like any other contributed module in drupal using the composer and enable it.


  • Create different configurations for different environments

1. Go to Admin -> Configuration -> Development -> Configuration Split settings                                                       

2. Click on Add Configuration Split Settings.                                                                                                                                    

3. Enter the label and the folder name (a new folder should be created for each environment inside config). Naming is always important. In the screenshot below, a split has been created for stage environment.                                                                                                                                                                    

4. Select the modules you want to split and the files associated with them. In the screenshot below, we have selected the stage file proxy module.                                                                                                                       

5. In order to activate the split, you have to modify settings.php file. Add the code below in settings.php file                                    

6. Now export your configurations using drush cex command. You can find that the module’s files are exported to the new directory created (in our case it is the config_stage folder). 

Points to be noted:

  • To test it on your local environment, activate the required split in settings.php file and perform the config import command using drush.
  • If you need a config split to be activated for a certain environment, add this code in settings.php file:- $config['config_split.config_split.your_split']['status'] = TRUE;   where your_split should be the name of your split.            

Leave a Reply

Your email address will not be published. Required fields are marked *