Drupal Configuration

When you change things in Drupal, like adding a field to a content type, it is modifying configuration.

When we develop sites, we want to test and adjust changes before they go live. This is a challenge for a CMS that lives on a server and is developed on individual computers.

Drupal has a system for managing configuration, allowing us to export it and track it in Git. This way we can configure a new feature and deploy it to the server without redoing each step.

Configuration Synchronization

When you make changes to Drupal, it is changing the site's configuration. You can export this configuration to save the current settings, and these configuration files can be used to deploy the changes to another site. This is very useful when you are working on a development copy of a site.

The site's configuration is stored in YML files. These are easy to read, although interpreting the parameters can take some time to learn.

The config files are stored in your config sync directory, defined in settings.php. By default, this is created in your files directory, which is not tracked in git. I will usually change this to "../config/sync" which is outside the web root, and tracked in git.

To access the admin UI: Configuration > Development > Configuration synchronization.

Development Workflow

Your live site has active users that expect it to be running smoothly. When we develop Drupal sites, we often have to try different settings, test modules, and create dummy content. We work in a separate development environment, usually on our own computers.

When the changes are ready, we can export the configuration, check it into git, and merge it into the live branch for deployment.

Default Configuration

Modules, themes, and profiles can include default configuration.

MODULE/config/install - Always installed.

MODULE/config/optional - Installed if dependencies are met.