Implement the current environment as a service and utilize plugins

Created on 11 August 2023, over 1 year ago
Updated 19 August 2024, 8 months ago

Problem/Motivation

This modules is cumbersome at best to configure, as it requires editing your actual infrastructure files like settings.php. Furthermore you have duplicate/match the colors within your settings file to match your config entities so things are consistent.

The crux of this complication is that your current environment is driven via config overrides, and the menu items are driven by configuration. There is no way to match everything up, and determine your environment dynamically. This adds complications when you want to do things like enforce permissions or update many sites in your workflow by just exporting your config.

Back in D7, the module supported regex matching, but that was removed during the port to D8. It stands to reason that there are multiple ways that the current environment could be determined, and it should be up to the user as to how they want to do so. This is a perfect use case for a plugin. There are also many issues here in the queue that could be much more easily resolved if we evolve the code in this way.

Currently I see three possible methods of determination:

  • The current settings.php config, with the addition of adding the machine name to enable permissions.
  • Simple host name matching
  • Regex based host name matching

Proposed resolution

  • Define a plugin manager for current environment
  • Add a dropdown on each environment to select the plugin to use
  • Allow for each plugin to provide configuration (like a regex pattern)
  • Evolve the code to determine the current environment through the plugin system.
  • Evolve the logic (permissions, rendering) to utilize the current environment properly through the plugin system.

There are already some tasks (somewhat) related to this in the queue:

Remaining tasks

  1. Update the documentation.
  2. Develop a plugin manager for current environment.
  3. Enable the plugin manager and the config entity to store plugin settings
  4. Determine how best to retain/cache the current environment, so as not to recalculate it on each page load.

User interface changes

A new select list on the environment indicator form to select the plugin, and load in the selected plugin's config form.

πŸ“Œ Task
Status

Active

Version

4.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States devkinetic

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024