2017 © Pedro Peláez
 

drupal-module xeno_config_split

Creates xeno media configuration split settings

image

xenomedia/xeno_config_split

Creates xeno media configuration split settings

  • Thursday, April 26, 2018
  • by xenomedia
  • Repository
  • 1 Watchers
  • 0 Stars
  • 1 Installations
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Xeno Media Configuration Split

Background

Xeno Media builds tons of sites. This module allows all our sites to quickly create a unified config split accross all our sites., (*1)

Installation

Install the module:, (*2)

composer require drupal/config_split
composer require drupal/config_ignore
composer require xenomedia/xeno_config_split

Enable the modules:, (*3)

drush en xeno_config_split -y

Create/update drush/policy.drush.inc file:, (*4)

<?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:, (*5)

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:, (*6)

$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:, (*7)

// 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., (*8)

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., (*9)

// 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., (*10)

// 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., (*11)

// 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:, (*12)

@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., (*13)

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., (*14)

How to use it

See Configuration Split for full documentation., (*15)

In short, update your settings.local.php for the environment you want to make changes to., (*16)

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., (*17)

Run drush csim -y, (*18)

Select the module in the Complete Split select., (*19)

Run drush csex -y, (*20)

Example: Ignore Webform settings

Navigate to /admin/config/development/configuration/ignore, (*21)

Add webform.webform.* to text area, (*22)

Save Configuration, (*23)

Run drush csex -y, (*24)

The Versions

26/04 2018

dev-master

9999999-dev https://github.com/xenomedia/xeno_config_split

Creates xeno media configuration split settings

  Sources   Download

GPL-2.0+

The Requires

  • drupal/config_split *
  • drupal/config_ignore *

 

configuration drupal configuration management