Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default to EMERGENCY_BANNER_REDIS_URL in Emergency Banner's Redis #3445

Merged
merged 1 commit into from
Sep 27, 2024

Conversation

Gweaton
Copy link
Contributor

@Gweaton Gweaton commented Sep 26, 2024

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 from
here 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.

This is a new environment variable we've currently added to Integration
to allow us to using Whitehall's Redis instance, which is shared with
Static.

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 from
[here](https://gist.github.com/jazzytomato/79bb6ff516d93486df4e14169f4426af)
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.
@Gweaton Gweaton changed the title Default to EMERGENCY_BANNER_REDIS_URL in controller Default to EMERGENCY_BANNER_REDIS_URL in Emergency Banner's Redis Sep 26, 2024
@Gweaton Gweaton merged commit 1e9ca25 into main Sep 27, 2024
11 checks passed
@Gweaton Gweaton deleted the add-emergency-banner-url-to-redis branch September 27, 2024 09:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants