Is it possible to import one single configuration file by specifying its path, or a group of Yaml files contained in a specific module?
You can by enabling the config module and then using the single import page.– user21641Nov 28, 2016 at 9:11
Thanks @IvanJaros, can you expand the comment to an answer with details how to enable the config module and the path to the single import page? Is there any way to achieve the same results with drush or drupal console? If it works, I'll accept the answer. Cheers!– David RiccitelliNov 28, 2016 at 9:37
i guess you can put the file into config/sync directory and just run drush cim, ive always used ui for single config file.– user21641Nov 28, 2016 at 9:42
That would import all the files in the sync directory.– David RiccitelliNov 28, 2016 at 12:40
You can use
$ drush cim --partial --source=only-few-configs/
Your help says:
$ drush cim --help Import config from a config directory. Examples: drush config-import --partial Import configuration; do not remove missing configuration. Arguments: label A config directory label (i.e. a key in $config_directories array in settings.php). Defaults to 'sync' Options: --partial Allows for partial config imports from the source directory. Only updates and new configs will be processed with this flag (missing configs will not be deleted). --preview=<list> Format for displaying proposed changes. Recognized values: list, diff. Defaults to list. --source An arbitrary directory that holds the configuration files. An alternative to label argument Aliases: cim
14That's great, but if you want to import one file you have to move it to another partial directory? That's weird, isn't it?– rreissJul 24, 2018 at 7:53
3If running in Lando/Docker, prefix the directory path with
/app/(as suggested in the Drupal Console answer).– colanApr 21, 2020 at 16:37
@rreiss agree, spot on. +1 Seems another example of an obvious usability that gets overlooked and a detatchment of reality the makers of these tools from what people need. Aug 25, 2020 at 16:51
I came here because I can't be sure that
core.extension.ymlis running before the other config that depends on it is running. I keep getting errors about PlugIns (i.e. Drupal contrib modules) not existing. So I want to import
core.extension.ymlfirst hence the need to import just this file. Aug 25, 2020 at 16:55
1I had some problems to find out the right path: /cms/web$ drush config-import --partial --source=sites/default/files/config/foo as an working example for my case ... you see the structure ... Oct 12, 2021 at 12:20
You can import one configuration by running the following command:
If you are trying to run multiple import you can create a chain for that.
Command Documentation - config:import:single
7Is there an option for drush aswell?– BenediktOct 16, 2017 at 7:10
11Tip for Lando/Docker users - you need to specify the full path when running in a container, e.g.
drupal config:import:single --directory="/app/config/sync" --file="foo.settings.yml", rather than just config/sync when you are in /app - otherwise you'll get [ERROR] Value can not be empty. (Fortunately Drupal Console's source code is nice and easy to debug.) Jul 25, 2018 at 5:55
This is fantastic. Note that it didn't like working for me using lando, I had to
lando sshso the machine first and then run it natively. Jul 28, 2020 at 3:32
I've created a feature request on drush for this: github.com/drush-ops/drush/issues/5146– malcomioMay 13, 2022 at 9:08
In case you don't have Drush or Drupal console installed, please use the following steps (executed successfully in D 8.0.1):
- Go to Administration->Configuration->Configuration Synchronization. Configuration can be exported for a single item or for entire site. I did for a single user.mail.yml file. Export the required configuration.
- Modify the changes to the exported configuration.
- Import the modified configuration
- Once import is successful, ensure that you clear the existing data from config and cache_config tables(Extract a dump of the database and search for the configuration keywords. That way you will know the tables where the entry is present.)
Note - Always take a backup.
Note that in current versions this is found under Administration->Configuration->Development->Configuaration Synchronization->Import at the path /admin/config/development/configuration/full/import Sep 13, 2021 at 18:07