Default to EMERGENCY_BANNER_REDIS_URL in Emergency Banner's Redis #3445
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Trello card
In alphagov/govuk-helm-charts@5011635 we added a new
EMERGENCY_BANNER_REDIS_URL
environment variable to Static on Integration pointing to Whitehall Admin's newly-provisioned Redis instance's database (/1
).Here we access that value in the Emergency Banner's Redis client which shares this Redis instance.
For environments that don't have this variable set yet (i.e. Staging and Production) we fallback on the default
REDIS_URL
.This is temporary - once we've moved all environments over to the new URL we can remove this default.
mock_env
is shamelessly copied fromhere and allows us to specify some environment variables that won't persist between tests.
The memoization of the instance variable in the class method was a tricky one to overcome, as the setup persisted across tests. I've had to manually clear it on these new tests to get this working.
NB: We'll need to deploy the corresponding change in Whitehall's codebase at the same time as this one to ensure the two are using the same shared instance
Follow these steps if you are doing a Rails upgrade.