How to change DB active config storage of an installed site to config file storage?

Solutions

Here are the steps I followed:

1) Export settings to your current $config_directories['sync'] directory (by default it is defined in settings.php and it is something like 'sites/default/files/config_VerYlonGkEY0123/sync')

$ drush cex

2) Create these directories (should be writable):

config/
  active/
  staging/
  sync/

3) Copy/paste all files from $config_directories['sync'] to config/active/

4) Add the new settings to settings.php

$config_directories = array(
  CONFIG_ACTIVE_DIRECTORY => DRUPAL_ROOT . '/config/active',
  CONFIG_STAGING_DIRECTORY => DRUPAL_ROOT . '/config/staging',
  CONFIG_SYNC_DIRECTORY => DRUPAL_ROOT . '/config/sync',
);

$settings['bootstrap_config_storage'] = array('Drupal\Core\Config\BootstrapConfigStorageFactory', 'getFileStorage');

5) Add this to service.yml (in the same directory as the settings.php):

services:
  config.storage:
    class: Drupal\Core\Config\CachedStorage
    arguments: ['@config.storage.active', '@cache.config']
  config.storage.active:
    class: Drupal\Core\Config\FileStorage
    factory: Drupal\Core\Config\FileStorageFactory::getActive

6) Export the settings to sync:

$ drush cex sync

Than you should have the settings in config/sync :)

Tags: Drupal 8

Similar questions

Installed Module crash my site. How do I bring my site back up by uninstalling a module
I installed a module but it crashed my site and I can't get to the administrator backend anymore. How do I disable this module to bring the site back up?
Is there a way with drush or console to delete all active config with a certain prefix?
I'm currently trying to migrate a site with drush migrate-upgrade --configure-only ... and copying the export migrate_plus.migration_*.yml into a custom module for tweaking. Now I want to enable that module but I get PreExistingConfigException.php and ... provided by MYMODULE already exist in active configuration. I'd like to delete all config but ...
Set value in $form_state['storage'] seems to change before validation
I am sure that I do not understand something fundamental about Drupal's form API but I hope that someone can help me with that: I want to create some kind of custom CAPTCHA as the CAPTCHA module states that with caching enabled on your project problems could appear and my project really needs caching via the Boost module. The idea was the following...
Need advice on remote storage for load balanced drupal site
Not quite sure if this is the correct thread to be posting this in, so please feel free to move it if its not. Background: Our developers have nearly finished developing our Drupal 7 based web application and as with any start up, I am assuming the role of the sys admin, financial controller and everything else under the sun! My experience with Lin...
Move file storage to another server
Consider this: I have one fast server with a Drupal installation but this server does not have access to a lot of disk space. I have another server that isn't quite as fast but does have access to lot of disk space. My drupal server is hosting a blog and some photo galleries. I would like my drupal server to use the file server to store its images ...
Move File Field storage from public:// to another stream wrapper (like s3://)
I've been looking around for this a bit, and it seems like it would be relatively easy in Drupal 7, since D7 supports stream wrappers, and Fields are part of core... but I can't find any documentation. I have a file field with a few thousand files attached to nodes, and it's using public:// right now. I also have the AmazonS3 module installed, and ...

Also ask

We use cookies to deliver the best possible experience on our website. By continuing to use this site, accepting or closing this box, you consent to our use of cookies. To learn more, visit our privacy policy.