Skip to content

Environment banner#1246

Merged
swebberuk merged 1 commit intomainfrom
DTOSS-12497-environment-banner
Apr 28, 2026
Merged

Environment banner#1246
swebberuk merged 1 commit intomainfrom
DTOSS-12497-environment-banner

Conversation

@swebberuk
Copy link
Copy Markdown
Contributor

@swebberuk swebberuk commented Mar 26, 2026

Description

Add environment banner to top of page. Using DJANGO_ENV to determine environment.

image image

Jira link

https://nhsd-jira.digital.nhs.uk/browse/DTOSS-12497

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 26, 2026

The review app at this URL has been deleted:
https://pr-1246.manage-breast-screening.non-live.screening.nhs.uk

@swebberuk swebberuk changed the title Environment banner [wip] Environment banner Mar 27, 2026
@swebberuk swebberuk force-pushed the DTOSS-12497-environment-banner branch from 68f4f15 to 5c56c99 Compare March 30, 2026 08:00
"static": static,
"url": reverse,
"inflector": inflector,
"DJANGO_ENV": settings.DJANGO_ENV,
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tried using ENV_CONFIG instead of DJANGO_ENV, but ENV_CONFIG did not appear to be being set.

"ENV_CONFIG": os.environ.get("ENV_CONFIG", "unknown"),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's ENV_CONFIG?

I think you still need to pass IS_PRODUCTION into this globals list for it to be picked up in the template?

Copy link
Copy Markdown
Contributor Author

@swebberuk swebberuk Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's ENV_CONFIG?

ENV_CONFIG, and ENVIRONMENT, are both variables I could see in the various variables.sh files. They have values like dev, review, preprod and prod. Before trying DJANGO_ENV, I did try using ENV_CONFIG to determine the environment being used but it did not seem to be available in the application, not just in local development but also in the review app. Therefore I used DJANGO_ENV instead. I've since noticed that we're using DJANGO_ENV elsewhere in the app to determine the environment, so think that is appropriate to use for this.

Example variables.sh containing ENV_CONFIG, and ENVIRONMENT https://github.com/NHSDigital/dtos-manage-breast-screening/blob/main/infrastructure/environments/prod/variables.sh

I think you still need to pass IS_PRODUCTION into this globals list for it to be picked up in the template?

Yes, you're correct. I had made that change locally but forgot to push. Sorry. Now corrected. Thank you.

@swebberuk swebberuk changed the title [wip] Environment banner Environment banner Mar 30, 2026
@swebberuk swebberuk marked this pull request as ready for review March 30, 2026 08:09
{% block pageTitle %}{% if form and form.errors %}Error: {% endif %}{% if page_title %}{{ page_title }} – {% endif %}Manage breast screening – NHS{% endblock %}

{% block header %}
{% if DJANGO_ENV != 'prod' %}
Copy link
Copy Markdown
Contributor

@MatMoore MatMoore Mar 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This contradicts other code that does DJANGO_ENV = environ.get("DJANGO_ENV", "production") i.e. production instead of prod

I'm not sure what it's actually set to in practice.

Can we add an IS_PRODUCTION var to settings.py to ensure consistency?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added IS_PRODUCTION to base.py. Use that instead of checking if DJANGO_ENV is production.

@swebberuk swebberuk force-pushed the DTOSS-12497-environment-banner branch from 5c56c99 to 033e32c Compare April 1, 2026 13:55
@swebberuk swebberuk force-pushed the DTOSS-12497-environment-banner branch from 033e32c to deb02e4 Compare April 1, 2026 14:54
@swebberuk swebberuk force-pushed the DTOSS-12497-environment-banner branch from deb02e4 to ba353c9 Compare April 1, 2026 16:02
@swebberuk swebberuk force-pushed the DTOSS-12497-environment-banner branch from ba353c9 to 1ea9415 Compare April 20, 2026 12:13
@swebberuk swebberuk force-pushed the DTOSS-12497-environment-banner branch from 1ea9415 to 4855908 Compare April 24, 2026 13:32
@swebberuk swebberuk force-pushed the DTOSS-12497-environment-banner branch from 4855908 to e45f936 Compare April 24, 2026 16:51
Uses DJANGO_ENV to determine environment name
@swebberuk swebberuk force-pushed the DTOSS-12497-environment-banner branch from e45f936 to db2dea0 Compare April 28, 2026 15:09
@sonarqubecloud
Copy link
Copy Markdown

@swebberuk swebberuk merged commit 31bc616 into main Apr 28, 2026
13 checks passed
@swebberuk swebberuk deleted the DTOSS-12497-environment-banner branch April 28, 2026 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants