- Issue created by @devkinetic
- Merge request !28Issue #3380586: Drop support for config overrides and use switcher values β (Open) created by devkinetic
- πΊπΈUnited States devkinetic
Upon further thought, I don't see why we couldn't extend the current environment deriver to be plugin based. We already have the ability to provide at least:
- 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
This would vastly simplify the upgrade path, as the settings.php plugin would be active by default.
After implementation, we would have to take another swing at permissions, to cover existing sites that do not have the machine name in settings.php.
- πΊπΈUnited States devkinetic
I've done some experimentation with converting the current environment code into a plugin system. I'm currently working through the ability to add settings for each implementation of the plugin, for example the patterns for the regex. This is apparently accomplished with
EntityWithPluginCollectionInterface
which is not documented very well.As things stand the issue description stands to be updated.
- First commit to issue fork.
- π¨π¦Canada colan Toronto π¨π¦
I'm not sure how far you got with this as there haven't been any updates in a while.
At first, I thought this was overkill, but it makes sense if you really want to support all of these use cases.
But I'm not sure it's even necessary. Why wouldn't folks simply want to automatically determine by URL? This could include regexes and aliases (say for private or non-load-balanced hostnames)? These can be enhancements added on later.
I'm coming from π¬ Granular permissions are not working as expected. Active , where I had to use the environment ID to determine the necessary permission to check for, which I need to set in settings.php, but that's just because it was quick. Machine names wouldn't need to be set if we just relied on the URL (or some variation/alias).
- π§πͺBelgium svendecabooter Gent
I think a plugin system for detecting the current environment would be really helpful.
While a lot of people would opt to use URL matching to discover the current environment, I can see other methods being used:
- a config override in settings.php
- a setting in \Drupal::state()
- a system environment variable (retrieved via getenv()) - e.g. set by a CI script targetting a specific environment
- ...