Managing Drupal Configuration Overrides With Config Split
Drupal configuration becomes difficult to manage when one codebase serves several environments. Development may need verbose error messages, a staging site may require test integrations, and production must use secure credentials, caching, and performance settings. Editing configuration manually on each server creates drift and makes deployments harder to trust.
Config Split provides a controlled way to keep shared configuration in Drupal’s normal synchronisation directory while storing environment-specific differences in separate splits. It is useful for local development, testing, user acceptance review, and production releases where the same modules and features must behave differently.
The approach is especially valuable for Australian organisations operating across Sydney, Melbourne, Brisbane, or Perth, where development teams, agencies, and hosting providers may use different infrastructure. A predictable configuration workflow reduces the risk of deploying a staging setting to a live customer-facing website.
Config Split does not replace Drupal configuration management. It extends it. The main configuration remains the source of truth, while selected settings are deliberately blacklisted, graylisted, or placed into separate directories. The result is a repeatable deployment process that can be reviewed in Git.
How Config Split Fits Into Drupal
Drupal stores site configuration as YAML files. A standard export writes those files to the synchronisation directory, often configured in settings.php with a hash-based path outside the web root. Running a configuration import then applies the files to the active database configuration.
Config Split adds named configuration sets to this process. A common arrangement contains a dev split, a stage split, and a prod split, although many projects only need a development split and a production override. Each split has its own directory and activation status.
The important distinction is that Config Split does not make arbitrary database changes permanent. It controls which configuration is included during export and import. If a setting is excluded from the main synchronisation set, it must still be represented clearly in the relevant split or managed by another deployment mechanism.
For example, a development split may contain verbose logging, local mail settings, and a visible toolbar. Production can keep those values absent or disabled while sharing the same content types, views, fields, roles, and modules.
Installing And Creating A Split
Install the module with Composer from the Drupal project root:
composer require drupal/config_split
Enable it with Drush:
drush en config_split -y
drush cr
The administrative interface is available under Configuration, Development, Configuration Split. Create a split with a clear machine name and an absolute or project-relative directory that is outside the public document root where practical. A typical project may use directories such as config/splits/dev and config/splits/prod.
Each split has an activation status and configuration filters. The split directory should be included in version control when it contains intentional settings. It should not contain secrets such as API keys, private tokens, or payment credentials. Those values belong in environment variables, a secrets manager, or protected server settings.
The directory structure must be consistent across local machines and deployment targets. A developer working on a Mac in Melbourne, a CI runner in Sydney, and a production server in a different Australian data centre should all resolve the same split paths after the codebase is deployed.
Choosing Settings For Each Environment
The safest starting point is to keep shared, functional site configuration in the main synchronisation directory. Content types, field storage, display modes, views, image styles, and most module settings usually belong there. These settings describe how the website works for every environment.
Environment-specific values should be isolated only when there is a clear operational reason. Development-only configuration often includes local services, test email transport, debugging, and disabled cache layers. Staging may need a payment sandbox, a search test index, or restricted access for editors reviewing an upcoming release.
Use the following classification when deciding where a setting belongs:
- Shared configuration required by every environment
- Development values used for debugging or local services
- Staging integrations connected to test systems
- Production values protected by deployment infrastructure
Config Split supports blacklist and graylist behaviours, and the exact choice matters. A blacklisted item is excluded from the regular configuration set and controlled by the split. A graylisted item can be handled differently depending on whether the split is active. Read the module’s current documentation and test the chosen behaviour before applying it to a large configuration collection.
Avoid splitting a setting simply because its value differs temporarily. Temporary experimentation is often better handled in a local override or a short-lived branch. A split should represent a stable environmental distinction that the team expects to preserve.
Managing Secrets And Runtime Overrides
Config Split is not a secret store. YAML files committed to Git can be read by anyone with repository access, and exported configuration may be copied into build artefacts. Passwords, OAuth secrets, private API keys, and database credentials should never be placed in a split directory.
Drupal’s settings.php and settings.local.php are suitable for runtime values. A deployment system can inject environment variables, while Drupal reads them with code such as:
$settings['my_service_api_key'] = getenv('MY_SERVICE_API_KEY');
For more complex projects, use a hosting platform’s secret management facilities or a dedicated vault. This is particularly important for Australian businesses handling customer information under contractual privacy requirements or operating in regulated sectors.
Runtime settings and exported configuration should have clear boundaries. A module’s endpoint URL may be configuration, while its authentication token is a secret. A logging level may belong to Config Split, while the destination credentials for a remote logging service should remain outside Git.
Do not assume that hiding a field in the Drupal interface protects its value. If the value is exported into YAML, appears in a database dump, or is printed in a deployment log, it can leak. Review configuration exports before committing them and add secret-bearing files to appropriate ignore rules.
Exporting And Importing Safely
A reliable workflow starts by changing configuration through Drupal’s interface or Drush, then exporting it from the intended environment. The standard command is:
drush config:export
After selecting the correct split, inspect the Git diff. Check that shared settings changed in the main directory and environment-specific settings changed only in their intended split. A diff review often catches accidental changes to site name, email addresses, trusted host patterns, or production integrations.
On the target server, deploy code and configuration together, then run the import:
drush config:import -y
drush cache:rebuild
The exact order may vary with the hosting platform, but configuration imports should happen through the same automated process each time. Avoid logging into production to change a value manually after deployment, because the next import may overwrite it or create unexplained drift.
A practical release sequence for an Australian agency might include a pull request review, a CI configuration validation, deployment to a staging environment during business hours, and production release after the client’s content team has checked the site. Teams working across AEST and AWST should document the release timezone so approval and monitoring windows are unambiguous.
Use Drush to inspect active configuration and confirm that the expected split is enabled. If the result is surprising, compare the generated files before importing rather than trying to repair the database by hand.
Keeping Local, Staging, And Production Aligned
Configuration Split works best when environments share the same code and module versions. A split cannot compensate for a missing module, a different schema, or a custom module that behaves differently between servers. Commit Composer files and deploy dependencies consistently.
Local environments commonly need development services such as Mailpit, DDEV, Lando, or a local Solr instance. Staging should resemble production closely enough to expose caching, search, permissions, and integration problems. Production should use its real performance and security controls, including suitable cache settings and trusted host configuration.
For a site hosted in Australia, latency can reveal issues that are invisible on a local machine. Test integrations from the same region as the production infrastructure when possible, especially for external payment gateways, identity providers, maps, and marketing platforms. A Sydney developer testing against a service hosted overseas may see different response times from customers using an Australian CDN edge.
Maintain a short environment record in the project documentation. State which split is active, where its directory lives, which values come from environment variables, and which services are safe to contact. This prevents a new team member from pointing a local build at a live email relay or production search index.
Testing Configuration Before Release
Configuration testing should verify both positive and negative cases. Confirm that the development split enables debugging, that staging uses sandbox services, and that production does not expose development tools. Also check that disabled settings really remain disabled after a fresh import and cache rebuild.
A CI pipeline can run configuration validation, coding standards, database updates, and a dry-run deployment. It can also compare exported configuration against the committed files. Failing the build when unexpected configuration appears gives the team an early warning before a release reaches a public domain.
When checking how links and rendered content behave across environments, include representative external references in a controlled test page; for example, a non-Drupal page containing crypto reel slot examples can confirm that link filtering, outbound attributes, and editorial formatting are preserved. Keep such test content separate from production content and remove it before launch.
Useful release checks include the following:
- Confirm the intended split is active on the target environment
- Review exported YAML and the Git diff before deployment
- Test mail, search, payment, and analytics integrations safely
- Rebuild caches and inspect logs after import
A staging check should also cover permissions and editorial workflows. A configuration import may succeed while an editor cannot access a newly changed field, or while a view displays an unexpected result because content differs between environments.
Troubleshooting Common Split Problems
One frequent problem is a configuration change appearing in the main synchronisation directory instead of the split. This usually means the item was not added to the appropriate filter, the split was inactive during export, or the export command ran in a different environment than expected. Review the split settings and repeat the export from a clean working tree.
Another issue occurs when a split setting seems to disappear after import. Check whether the target environment has the split enabled and whether the split directory was deployed. A directory missing from the release artefact cannot provide the override, even when the module is installed and configured.
Module updates can change configuration keys or introduce new settings that were not previously classified. After updating Drupal core or contributed modules, export configuration in a development environment and inspect the complete diff. Treat unexpected new keys as review items rather than automatically placing them in a split.
Use Drush status and configuration commands to establish facts:
drush status
drush config:status
drush config:get system.site name
drush config:export --diff
The exact options available can vary by Drush version, so check the command help on the project. Logs are especially useful when a service is missing, a YAML file is invalid, or a custom module expects a setting that was excluded accidentally.
Finally, keep split definitions simple. A small number of well-documented differences is easier to audit than a large collection of exceptions. When a setting becomes common to every environment, move it back into shared configuration and remove the obsolete override. This keeps Drupal’s configuration workflow predictable as the project grows.