accessdigital / wilson

A Drupal installation profile produced by Access. New installations should use https://github.com/accessdigital/drupal-template
https://www.weareaccess.co.uk
4 stars 1 forks source link

Adding environment_indicator module and initial config. #41

Closed AccessPaul closed 1 year ago

AccessPaul commented 1 year ago

This has been long requested and now Wilson includes Environment Indicator.

Though this includes some initial config, it will still be down to the project developers to finish the setup of this. There seems to be two ways this can be configured:-

  1. Add environment detection inside the project's settings.php file which triggers the correct colouring (see documentation in the module).
  2. Use Config Split to override the values of environment_indicator.indicator.yml depending on which environmental config is installed. Personally I'd say this is the better route (because it keep everything neatly inside the config system) but Wilson isn't opinionated beyond specifying initial environment colours.

Also, you'll want to update your site config with Acquia/Pantheon/... environment URLs once the project is underway.

Screenshot 2022-10-10 at 14 20 26
iamsophiesk commented 1 year ago

Use Config Split to override the values of environment_indicator.indicator.yml depending on which environmental config is installed. Personally I'd say this is the better route (because it keep everything neatly inside the config system) but Wilson isn't opinionated beyond specifying initial environment colours.

This just creates the different environment indicators (that you've already exported into config) - as far as I know, you need to use settings.php to make sure they're enabled on whichever environments.

Is it worth adding snippets to the readme or something so that folks can do that?

AccessPaul commented 1 year ago

Use Config Split to override the values of environment_indicator.indicator.yml depending on which environmental config is installed. Personally I'd say this is the better route (because it keep everything neatly inside the config system) but Wilson isn't opinionated beyond specifying initial environment colours.

This just creates the different environment indicators (that you've already exported into config) - as far as I know, you need to use settings.php to make sure they're enabled on whichever environments.

So I'm no expert in this module but by reading the module homepage and having looked through the config, it does appear there's two ways to set this up. I.e. through settings.php or by config splitting the one config file mentioned. Personally, I'm more comfortable with the config system than having some setup in config and some in settings.php. And if it's not clear what I mean...

You'd have something like the following, each stating their specific environment indicator name and colours:- config/default/environment_indicator.indicator.yml config/envs/dev/environment_indicator.indicator.yml config/envs/stage/environment_indicator.indicator.yml config/envs/prod/environment_indicator.indicator.yml

When say dev config split is deployed on the 'Dev' hosting environment, the relevant environment indicator settings would be in play. I suppose this is no guarantee that you haven't messed up and deployed dev config on 'Prod', but at that point you've got bigger concerns.

From the module page:

Environment Indicator UI Do you have different variable values for every different environment using settings.php? You can use the Environment Indicator UI sub-module for that. It will provide a UI to set the different values per environment that you can export in your config, without polluting your settings.php.