xenomedia / xeno_config_split
Creates xeno media configuration split settings
Installs: 606
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 1
Type:drupal-module
Requires
- drupal/config_ignore: *
- drupal/config_split: *
This package is auto-updated.
Last update: 2025-03-06 04:08:12 UTC
README
Background
Xeno Media builds tons of sites. This module allows all our sites to quickly create a unified config split accross all our sites.
Installation
Install the module:
composer require drupal/config_split
composer require drupal/config_ignore
composer require xenomedia/xeno_config_split
Enable the modules:
drush en xeno_config_split -y
Create/update drush/policy.drush.inc
file:
<?php /** * @file * Drush policies. */ /** * Implementation of drush_hook_COMMAND_validate(). */ function drush_policy_config_import_validate($source = NULL, $destination = NULL) { // Run error if someone tries to run config-import instead of // config-split-import. return drush_set_error(dt('Per policy.drush.inc, you should run drush csim instead of drush cim.')); } /** * Implementation of drush_hook_COMMAND_validate(). */ function drush_policy_config_export_validate($source = NULL, $destination = NULL) { // Run error if someone tries to run config-import instead of // config-split-import. return drush_set_error(dt('Per policy.drush.inc, you should run drush csex instead of drush cex.')); }
Create split directories:
mkdir -p config/dev touch config/dev/.keep mkdir -p config/stage touch config/stage/.keep mkdir -p config/prod touch config/mkdir -p config/prod/.keep
In your settings.php update/set your config directory to:
$config_directories[CONFIG_SYNC_DIRECTORY] = '../config/sync';
On Your local or development server add the following to your settings.local.php or settings.dev.php file:
// Config split settings for development. $config['config_split.config_split.production']['status'] = FALSE; $config['config_split.config_split.staging']['status'] = FALSE; $config['config_split.config_split.development']['status'] = TRUE;
If you are using Pantheon you can add the following to your settings.php file.
if (isset($_ENV['PANTHEON_ENVIRONMENT'])) { // Live Pantheon environment. if ($_ENV['PANTHEON_ENVIRONMENT'] == 'live') { $config['config_split.config_split.production']['status'] = TRUE; $config['config_split.config_split.development']['status'] = FALSE; $config['config_split.config_split.staging']['status'] = FALSE; } // Dev / Test / Multi Branch Pantheon environment. else { $config['config_split.config_split.production']['status'] = FALSE; $config['config_split.config_split.development']['status'] = FALSE; $config['config_split.config_split.staging']['status'] = TRUE; } } else { $config['config_split.config_split.production']['status'] = FALSE; $config['config_split.config_split.development']['status'] = TRUE; $config['config_split.config_split.staging']['status'] = FALSE; }
If you are not on pantheon create/update settings.dev.php.
// Config split settings for development. $config['config_split.config_split.production']['status'] = TRUE; $config['config_split.config_split.staging']['status'] = FALSE; $config['config_split.config_split.development']['status'] = FALSE;
If you are not on pantheon create/update settings.stage.php.
// Config split settings for staging. $config['config_split.config_split.production']['status'] = FALSE; $config['config_split.config_split.staging']['status'] = TRUE; $config['config_split.config_split.development']['status'] = FALSE;
If you are not on pantheon create/update settings.prod.php.
// Config split settings for product. $config['config_split.config_split.production']['status'] = TRUE; $config['config_split.config_split.staging']['status'] = FALSE; $config['config_split.config_split.development']['status'] = FALSE;
Then in your local.settings.php comment/uncomment basees on the environment:
@include('settings.dev.php');
# @include('settings.stage.php');
# @include('settings.prod.php');
Post-installation
This module is only meant as a starting point. Once installed you should uninstall the module.
drush pm-uninstall xeno_config_split composer remove xenomedia/xeno_config_split
There may be cases that you don't need a staging and development split since they may be exactly the same. In that case you can just delete one of them.
How to use it
See Configuration Split for full documentation.
In short, update your settings.local.php for the environment you want to make changes to.
Example: Add a module so it is only installed on production
Update your settings.local.php so that only production
is TRUE
and the
others are set to FALSE
.
Run drush csim -y
Select the module in the Complete Split select.
Run drush csex -y
Example: Ignore Webform settings
Navigate to /admin/config/development/configuration/ignore
Add webform.webform.*
to text area
Save Configuration
Run drush csex -y