Score:1

Why is my split config not loaded with drush config:import?

am flag

I have a setup with different environments called prod and dev.

I need to distinguish API Keys and Urls between these two environments and thought that split-config would be the ideal solution for that.

What I have done so far:

  1. Created a split config for dev (not active!) because the default sync config should be for prod.
  2. Duplicated the configurations for the specific modules and changed the values I need for the dev environment.
  3. Added these configurations to the grey list because I want to keep the configuration within sync.
  4. Made a condition within the settings.php file to enable or disable the dev split config depending on the current environment.

My deployment looks like this:

  1. drush updatedb
  2. drush cache:rebuild
  3. drush config:import
  4. drush cache:rebuild

What I thought would happen:

In my opinion as soon as the deployment runs on the dev environment the dev split config gets enabled and the drush config:import imports the config files configured within my dev split-config configuration.

What actually happens:

The configurations from the sync folder are loaded and within the admin ui I can see that the dev configs are staged. I can now use the import config button within the admin ui and after that my dev config is loaded.

What do I want to achieve here?

I want the configuration be loaded within my deployment.

Where do I need help?

The step to open the admin ui and explicitly import the configuration again seems like something is not right with my configuration. Could you please help me here? What am I missing?

Thanks! Pete

UPDATE:

Here are the steps from the deployment script I use:

  1. drush state:set system.maintenance_mode 1
  2. drush cache:rebuild
  3. pull everything that is new
  4. composer install --no-dev --no-interaction
  5. drush updatedb
  6. drush cache:rebuild
  7. drush config:import
  8. drush cache:rebuild
  9. drush config:import
  10. drush state:set system.maintenance_mode 0
  11. drush cache:rebuild
sonfd avatar
in flag
Can you post how you're enabling the dev split in settings.php? That works fine for me with something like: `$config['config_split.config_split.MY_SPLIT']['status'] = TRUE;`.
sonfd avatar
in flag
It sounds to me like your first import is actually responsible for enabling the config split. Which, as far as I know, would explain why an additional import is required to import configuration defined in the split.
leymannx avatar
ne flag
Yeah, maybe for the first time you need to `drush cim` twice. Also try `drush csim MY_SPLIT` to explicitly import the split.
cn flag
When picking this up, this tutorial was really helpful in understanding https://www.daggerhartlab.com/drupal-8-configuration-management-with-config-split/
am flag
@sonfd: Thanks for the hint, sadly this did not help. I am enabling the dev split via ```$config['config_split.config_split.dev']['status'] = TRUE;```. The admin ui even tells me that dev is active so this part is working. I just updated the question and added the deploy script.
am flag
@leymannx the Thanks for this hint!```drush --yes config-split:import dev```command seems to work. I just wonder why ```drush cim```is not working because in the [documentation](https://www.drupal.org/docs/contributed-modules/configuration-split/cli-integration) it is said that it should work.
leymannx avatar
ne flag
Yeah it actually should simply work with `cim`.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.