6

I have created different split for each environement (local, dev, test, prod) using the Configuration Split module. How can manage modules (enable/disable) in each environment?

Should I keep core.extensions.yml in each split and remove the module to be uninstalled from the list?

5

The core.extension.yml should only be put into the default, shared config. As it only holds those modules, that are enabled across all your different environments.

$config_directories['sync'] = '../config/sync/default/shared';

This default Drupal config sync directory also has the config_split.config_split.local.yml in it, which defines which modules apart from the ones in the core.extension.yml should be enabled additionally when the local split is active.

uuid: abc123456-7890-abcd-906d-abc123456
langcode: en
status: false
dependencies: {  }
id: local
label: Local
folder: ../config/sync/default/local
module:
  browsersync: 0
  devel: 0
  features_ui: 0
  field_ui: 0
  kint: 0
  link_css: 0
  masquerade: 0
  views_ui: 0
  webprofiler: 0
theme: {  }
blacklist: {  }
graylist: {  }
graylist_dependents: true
graylist_skip_equal: true
weight: 0

Then, inside each environment's settings.local.php you have to define which split in addition to the default, shared config should be active and which not. Here's how it may be configured on your local machine:

$config['config_split.config_split.local']['status'] = TRUE;
$config['config_split.config_split.dev']['status']   = FALSE;
$config['config_split.config_split.stage']['status'] = FALSE;
$config['config_split.config_split.prod']['status']  = FALSE;

The core.extension.yml only holds those modules that are shared among all your different environments.

  • This. It's critical to have every environment covered in your settings.php (or settings.local.php) like @leymannx has shown above. Some tutorials have shown where if production is set as the default configuration, a specific configuration split isn't needed, but in my tests, I haven't been able to get that to work. – karolus Oct 8 '18 at 19:25
  • When making changes to settings*php files and/or config like this. Remember to drush cache:rebuild if something isn't making sense. I often have to do this for config:import to pick up the changes I just made on disk. Even after that, I sometimes have to go to /admin/config/development/configuration/config-split to make sure the right environment is showing. And after a cache:rebuild even that page takes a reload (load up some cache?) to get the environment switched. Just play with it. – Elijah Lynn Aug 1 at 1:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.