Managing your site's configuration
Drupal stores site configuration data in a consistent manner—from the list of enabled modules to content types, taxonomy vocabularies, fields, and views.
Making configuration changes directly on a live site is not recommended. The configuration system is designed to make it easy to use the current configuration, test changes locally, export them to files, and then deploy them in a production environment. Your site’s configuration can be stored as part of your codebase and integrated into version control.
By default, the “active” configuration is stored in the database (in the config
table). This is for performance and security reasons. This represents the complete current configuration for the site. You can export and import configuration as YAML files either fully or partially using Drush, Drupal Console, or the Configuration Manager module (details below).
Exporting and importing configuration changes between Drupal installations in environments such as Development, Staging, and Production allows you to test changes safely away from your live site.
This setup lets you deploy configuration from one environment to another. As a safeguard, Drupal verifies that the site is the same before importing by comparing UUIDs.
Module and Theme Configuration Files
Default configuration provided by modules, distributions, and themes is imported into the active configuration storage when extensions are enabled. This default configuration is located in the config/install
directory of each extension.
How to Import, Export, and Sync
With the Configuration Manager core module, you can import, export, and synchronize site configuration at Manage > Configuration > Development > Configuration synchronization (/admin/config/development/configuration
). You can preview changes before importing them.
You can import or export a single configuration item using a copy/paste workflow, useful for moving things like views between environments.
Alternatively, the full site configuration can be exported as YAML files into a .tar.gz
archive. This works only between copies of the same site (e.g., dev and prod) and therefore requires matching site UUIDs.
Check a site’s UUID using CLI:
With Drush:
drush cget system.site
With Drupal Console:
drupal debug:config system.site
Full workflow examples:
After a successful sync, changes such as new modules, fields, or content types are applied. In short, all configuration updates made on the development site are now live.
More Information
For deeper insight into the configuration management system in Drupal 8, see the Configuration API documentation.
Do’s and Don’ts
DO:
It’s strongly recommended to perform a database dump before any sync between staging and active directories. A database dump can "save your life" in case a rollback is needed.
DON’T:
Do not attempt to modify active configuration by editing files in a module’s config/install
directory.
This won’t work because Drupal reads from this directory only when the module is initially installed.
To live-edit configuration, use drush config-edit or drupal config:edit.
Drupal’s online documentation is © 2000-2020 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution-ShareAlike 2.0. PHP code is distributed under the GNU General Public License.