Problem/Motivation
If the module is installed but not enabled (for example via config import), trying to enable it via UI won't work because of a missing API key. At this point it is only possible to generate the API key by:
- Uninstalling and installing the site Guardian module via UI.
- Generate the API key somehow and configure it for the module.
Notice that if you install the module via UI, the API key is generated as expected.
Steps to reproduce
- Install the Site Guardian module via configuration. Notice that, because the configurations of the module should be ignored (there's still some conversations ongoing about this) the module will only be installed but not enabled.
- As a post deployment task try to enable Site Guardian via UI, this step will fail due to a missing key.
Proposed resolution
Add a 'Generate API Key' button to the Site Guardian configuration page, so that a new random key can be generated at discretion for whatever reason, with no need to uninstall or disable Site Guardian.
Comments
Comment #3
seeduardo commentedReady for review, thanks anyone and everyone.
Comment #4
the_g_bomb commentedTested applying the patch. Applies cleanly.
Before patch Site Guardian loads and generates the API as expected.
After the Patch a button appears that allows the API key to be re-generated.
Very nice!
Comment #5
alina.basarabeanu commentedThe patch works as expected on the Drupal version 10.2.5 and Site Guardian 1.0.4.
Comment #6
alina.basarabeanu commentedComment #7
eworwa commentedI can confirm the patch applies with no issues, my current configuration:
After applying the patch there's a new button to re-generate the API key (nice improvement).
Comment #8
ricardofaria commentedTested on site guardian 1.0.4 and drupal 10.2.2.
All working as expected.
Comment #9
arcaicApplies to Site Guardian 1.0.5 on Drupal 10.2.5 and seems to work fine.
Comment #13
seeduardo commentedOk appears the solution is robust enough, thanks so much for all testing and comments and others who helped with this - merging and closing now.