Support multiple environments for DEV/TEST/LIVE (other?)

Created on 27 February 2025, 4 months ago

Problem/Motivation

When configuring SAMLAUTH, your metadata generated, of course, matches the environment you're on.

This creates a chicken&egg scenario for "live" sites, which will have a different domain then your "DEV" or even "TEST" environments if you have that many.

How can one, support this module in CONFIG SYNC, when dealing with multiple environments?

example, using pantheon, at its simplest, you have 3 environments available to you.

dev-projectname.pantheonsite.io
test-projectname.pantheonsite.io
live-projectname.pantheonsite.io // yourrealdomain.com

Is it possible to support something like this in the module?

πŸ’¬ Support request
Status

Active

Version

4.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States alphex Atlanta, GA USA

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @alphex
  • πŸ‡³πŸ‡±Netherlands roderik Amsterdam,NL / Budapest,HU

    I rely on other people to specify their 'config sync' policy / best practices. So I'll rebrand this a task.

    People must be doing this. But so far, I don't remember anyone really commenting on it.

    Are they using config_ignore? If so, what are they ignoring? Just the entity ID (provided the certs are in files)?

    Do they want to use multiple IdP configs for this? ✨ Multiple IDP Support Needs work

    When there's a somewhat authoritative reply from someone, we can determine if this needs documentation, or other work.

  • πŸ‡ΊπŸ‡ΈUnited States jfurnas

    You can handle this very easily using config split. Make a new config split for each environment you are using (dev, staging, production), and inside of each config sync folder place your samlauth.authentication configuration inside of there, with the 'correct' values for each environment. Make sure that is not placed in your 'default' config sync folder.

    (So you'll have three instances of samlauth.authentication), one in each environment, and each with their own correct values per environment.

    Then in your settings.php (or via the configuration split UI), tell it which config split to use for each environment.

  • πŸ‡ΊπŸ‡ΈUnited States jfurnas

    As an example, here is what a config split looks like in one of the sites I am working on, through the Acquia environment.

    // Enable `dev` config split by default and disable `prod` and `stage` config split by default
    $config['config_split.config_split.development']['status'] = FALSE;
    $config['config_split.config_split.local_development']['status'] = FALSE;
    $config['config_split.config_split.production']['status'] = FALSE;
    $config['config_split.config_split.staging']['status'] = FALSE;
    
    if (isset($_ENV['AH_SITE_ENVIRONMENT'])) {
      if ($_ENV['AH_SITE_ENVIRONMENT'] == 'development') {
        $config['config_split.config_split.development']['status'] = TRUE;
        $config['config_split.config_split.local_development']['status'] = FALSE;
        $config['config_split.config_split.production']['status'] = FALSE;
        $config['config_split.config_split.staging']['status'] = FALSE;
      }
      if ($_ENV['AH_SITE_ENVIRONMENT'] == 'prod') {
        $config['config_split.config_split.development']['status'] = FALSE;
        $config['config_split.config_split.local_development']['status'] = FALSE;
        $config['config_split.config_split.production']['status'] = TRUE;
        $config['config_split.config_split.staging']['status'] = FALSE;
      }
      if ($_ENV['AH_SITE_ENVIRONMENT'] == 'test') {
        $config['config_split.config_split.development']['status'] = FALSE;
        $config['config_split.config_split.local_development']['status'] = FALSE;
        $config['config_split.config_split.production']['status'] = FALSE;
        $config['config_split.config_split.staging']['status'] = TRUE;
      }
    }
    else {
      $config['config_split.config_split.development']['status'] = FALSE;
      $config['config_split.config_split.local_development']['status'] = TRUE;
      $config['config_split.config_split.production']['status'] = FALSE;
      $config['config_split.config_split.staging']['status'] = FALSE;
    }
    

    Where we have four configuration folders (localdevelopment, development, staging, production) and the 'default' global configuration directory.

    When on the production environment, config split specifically only uses the configurations in 'default' and everything in our 'production' folder, which has per environment changes.

    Pantheon has similar environment variables you can use in your settings.php, but I don't recall what they are off the top of my head.

Production build 0.71.5 2024