Drupal provides the abitility to use config directories other than $config_directories[CONFIG_SYNC_DIRECTORY]

(CONFIG_SYNC_DIRECTORY is 'sync').

I have been using $config_directories['deploy'] = '../deploy';, for example, and not defining $config_directories['sync'] at all.

This module seems to assume that we are using $config_directories['sync'] as our main directory, so if we are not defining it, we get errors such as: "The split folder can not be in the sync folder".

That error is caused by the following code:

  protected static function isConflicting($folder) {
    global $config_directories;

    return strpos(rtrim($folder, '/') . '/', rtrim($config_directories[CONFIG_SYNC_DIRECTORY], '/') . '/') !== FALSE;
  }

In the above example, if $config_directories[CONFIG_SYNC_DIRECTORY] is not set, the "isConflicting()" method will return TRUE, which is not really the case.

Could we provide an error message on the admin page stating that config directories other than the default "sync" are not supported?

Comments

alberto56 created an issue. See original summary.

bircher’s picture

Title: If a config directory other than "sync" is used, display error message other than "The split folder can not be in the sync folder" which is misleading » Display an error on the split overview page if $config_directories[CONFIG_SYNC_DIRECTORY] is not set.

We can definitely do that.

But out of curiosity: why not using the 'sync' directory? Drupal core only uses that one and it is the only one with a service associated, so the only one that works out of the box with config_filter.

alberto56’s picture

That's true; here are two scenarios where I might use a different name:

(1) Acquia Cloud hosting uses the name 'vcs', not sync, as described here: https://docs.acquia.com/acquia-cloud/develop/config-d8 -- for my clients with Acquia Cloud, I use a Docker setup for local development where I reproduce the same name, 'vcs'.

(2) I use a technique I wrote about where I call the config directory 'deploy': http://blog.dcycle.com/blog/68/approach-code-driven-development-drupal-8/ -- the reason I had chosen to do this is that I like the idea that when the config directory is not in its default place, we name it something else. I suspect Acquia may have changed the name for that same reason.

bircher’s picture

Ok thanks for the information and the links.
I understand your reasoning but now things have changed a bit and if the sync directory is already set it will not be overwritten by the installer. I consider the default location to be '../config/sync' and we use that everywhere. I have no experience with the acquia cloud and I can't speak for them or their internal systems.

You can still use config split for developing sites hosted on such platforms of course, you just have to have a local environment that mirrors production. You would use the sync directory and the splits for sharing the config among developers and then in your production mirror you import from sync and you export to vcs/deploy. This of course means you can not have splits in production (or rather that they won't have any effect) but it also means there is no magic going on during the deployment. I would consider that a good thing and a feature but it comes at the cost of another step in your deployment.

ConfigFilters can specify for which storage they are used (splits are for the sync storage) so if you set up other storages and make them use ConfigFilters you can use the plugin alter hook to make some splits apply to your custom storage. But that is rather an advanced case. It is probably much simpler to just use the sync storage and get a config diff in the UI from core for free with it.

alberto56’s picture

Agreed: simpler is better. I think it is possible and desirable to use 'sync' locally; if I come across a scenario where this is not possible, I will re-post on this issue and/or open a new one. Thanks! I'll leave this issue open so we can warn developers if the sync directory is not set.

sebas5384’s picture

I can confirm this is an issue when we use a different config dir, and this is because we are using Acquia Cloud too.

There's any way to change the 'sync' to 'vcs' ?

thanks!

bircher’s picture

Config Split only works with the config.storage.sync service. This just so happens to be configured in settings.php the way it is. From the perspective of Config Split how that is defined is not important, and it is really easy to use Config Split with other ConfigStorages. But you also then need to teach drush to use the decorated service instead of creating a plain FileStorage, etc.

I can not speak for why Acquia Cloud does not use the drupal default. But it would be my guess that it is simplest to set $config_directories[CONFIG_SYNC_DIRECTORY] = $config_directories['vcs']; somewhere appropriate in your custom code. But maybe someone more familiar with Acquia Cloud can weigh in. I can just recommend to use 'sync'. That would then also work with the UI of drupal.