{"id":56420,"date":"2023-01-13T10:52:36","date_gmt":"2023-01-13T05:22:36","guid":{"rendered":"https:\/\/www.tothenew.com\/blog\/?p=56420"},"modified":"2023-01-23T10:58:32","modified_gmt":"2023-01-23T05:28:32","slug":"configuration-split-in-drupal","status":"publish","type":"post","link":"https:\/\/www.tothenew.com\/blog\/configuration-split-in-drupal\/","title":{"rendered":"Configuration Split in Drupal"},"content":{"rendered":"<h2><b>Introduction<\/b><\/h2>\n<p><span style=\"font-weight: 400;\">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.<\/span><\/p>\n<h2><b>Installing and configuring the Config Split Module<\/b><\/h2>\n<ul>\n<li><strong>Install the module like any other contributed module in drupal using the composer and enable it.<\/strong><\/li>\n<\/ul>\n<h4>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 <img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-56407 size-full\" src=\"\/blog\/wp-ttn-blog\/uploads\/2023\/01\/Screenshot-from-2023-01-13-10-10-22.png\" alt=\"\" width=\"499\" height=\"26\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2023\/01\/Screenshot-from-2023-01-13-10-10-22.png 499w, \/blog\/wp-ttn-blog\/uploads\/2023\/01\/Screenshot-from-2023-01-13-10-10-22-300x16.png 300w\" sizes=\"(max-width: 499px) 100vw, 499px\" \/><\/h4>\n<ul>\n<li><b>Create different configurations for different environments<\/b><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">1. Go to Admin -&gt; Configuration -&gt; Development -&gt; Configuration Split settings\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 <img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-56408 size-full\" src=\"\/blog\/wp-ttn-blog\/uploads\/2023\/01\/Screenshot-from-2023-01-13-10-12-59.png\" alt=\"\" width=\"505\" height=\"325\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2023\/01\/Screenshot-from-2023-01-13-10-12-59.png 505w, \/blog\/wp-ttn-blog\/uploads\/2023\/01\/Screenshot-from-2023-01-13-10-12-59-300x193.png 300w\" sizes=\"(max-width: 505px) 100vw, 505px\" \/>\u00a0 \u00a0<\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><\/p>\n<p><span style=\"font-weight: 400;\">2. Click on Add Configuration Split Settings<\/span><span style=\"font-weight: 400;\">.\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 <img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-56409 size-full\" src=\"\/blog\/wp-ttn-blog\/uploads\/2023\/01\/Screenshot-from-2023-01-13-10-15-04.png\" alt=\"\" width=\"622\" height=\"67\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2023\/01\/Screenshot-from-2023-01-13-10-15-04.png 622w, \/blog\/wp-ttn-blog\/uploads\/2023\/01\/Screenshot-from-2023-01-13-10-15-04-300x32.png 300w\" sizes=\"(max-width: 622px) 100vw, 622px\" \/><\/span><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">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.\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 <img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-56418\" src=\"\/blog\/wp-ttn-blog\/uploads\/2023\/01\/Screenshot-from-2023-01-13-12-38-54.png\" alt=\"\" width=\"634\" height=\"214\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2023\/01\/Screenshot-from-2023-01-13-12-38-54.png 634w, \/blog\/wp-ttn-blog\/uploads\/2023\/01\/Screenshot-from-2023-01-13-12-38-54-300x101.png 300w, \/blog\/wp-ttn-blog\/uploads\/2023\/01\/Screenshot-from-2023-01-13-12-38-54-624x211.png 624w\" sizes=\"(max-width: 634px) 100vw, 634px\" \/>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 <\/span><\/span><span style=\"font-weight: 400;\">\u00a0 \u00a0\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">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.\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 <img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-56414\" src=\"\/blog\/wp-ttn-blog\/uploads\/2023\/01\/Screenshot-from-2023-01-13-12-00-51.png\" alt=\"\" width=\"625\" height=\"289\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2023\/01\/Screenshot-from-2023-01-13-12-00-51.png 625w, \/blog\/wp-ttn-blog\/uploads\/2023\/01\/Screenshot-from-2023-01-13-12-00-51-300x139.png 300w\" sizes=\"(max-width: 625px) 100vw, 625px\" \/>\u00a0 <\/span><\/p>\n<p><span style=\"font-weight: 400;\">5. In order to activate the split, you have to modify settings.php file. Add the code below in settings.php file\u00a0<\/span><span style=\"font-weight: 400;\"> \u00a0 \u00a0 \u00a0 \u00a0 <img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-56415\" src=\"\/blog\/wp-ttn-blog\/uploads\/2023\/01\/Screenshot-from-2023-01-13-12-04-29.png\" alt=\"\" width=\"598\" height=\"18\" srcset=\"\/blog\/wp-ttn-blog\/uploads\/2023\/01\/Screenshot-from-2023-01-13-12-04-29.png 598w, \/blog\/wp-ttn-blog\/uploads\/2023\/01\/Screenshot-from-2023-01-13-12-04-29-300x9.png 300w\" sizes=\"(max-width: 598px) 100vw, 598px\" \/>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">6. Now export your configurations using drush cex command. You can find that the module&#8217;s files are exported to the new directory created (in our case it is the config_stage folder).\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\"><b>Points to be noted:<\/b><\/span><\/p>\n<ul>\n<li><span style=\"font-weight: 400;\">To test it on your local environment, activate the required split in settings.php file and perform the config import command using drush.<\/span><\/li>\n<li><span style=\"font-weight: 400;\">If you need a config split to be activated for a certain environment, add this code in settings.php file:- <code><span class=\"nv\">$config<\/span><span class=\"p\">[<\/span><span class=\"s1\">'config_split.config_split.your_split'<\/span><span class=\"p\">][<\/span><span class=\"s1\">'status'<\/span><span class=\"p\">]<\/span> <span class=\"o\">=<\/span> <span class=\"kc\">TRUE<\/span><span class=\"p\">; <\/span><\/code>\u00a0 where your_split should be the name of your split.<\/span><span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0\u00a0<\/span><\/li>\n<\/ul>\n<div class=\"ap-custom-wrapper\"><\/div><!--ap-custom-wrapper-->","protected":false},"excerpt":{"rendered":"<p>Introduction 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. [&hellip;]<\/p>\n","protected":false},"author":1533,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":143},"categories":[3602],"tags":[5081],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/56420"}],"collection":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/users\/1533"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/comments?post=56420"}],"version-history":[{"count":3,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/56420\/revisions"}],"predecessor-version":[{"id":56474,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/56420\/revisions\/56474"}],"wp:attachment":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/media?parent=56420"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/categories?post=56420"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/tags?post=56420"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}