Commit 33afa3be authored by Alexander Pace's avatar Alexander Pace
Browse files

selectively hide reports link with env variable

parent 23d35284
Pipeline #391021 passed with stages
in 30 minutes and 15 seconds
......@@ -29,8 +29,11 @@ MAINTENANCE_MODE_MESSAGE = None
INFO_BANNER_ENABLED = False
INFO_BANNER_MESSAGE = "TEST MESSAGE"
# Beta reports page:
BETA_REPORTS_LINK = False
# Version ---------------------------------------------------------------------
PROJECT_VERSION = '2.14.1'
PROJECT_VERSION = '2.14.2'
# Unauthenticated access ------------------------------------------------------
# This variable should eventually control whether unauthenticated access is
......
......@@ -155,7 +155,7 @@ info_banner_enabled = get_from_env(
'DJANGO_INFO_BANNER_ENABLED',
default_value=False,
fail_if_not_found=False
)
)
# fix for other booleans:
if (isinstance(info_banner_enabled, str) and
info_banner_enabled.lower() in ['true','t','1']):
......@@ -163,6 +163,17 @@ if (isinstance(info_banner_enabled, str) and
INFO_BANNER_MESSAGE = \
get_from_env('DJANGO_INFO_BANNER_MESSAGE', fail_if_not_found=False)
# Get reports page boolean:
beta_reports_link = get_from_env(
'DJANGO_BETA_REPORTS_LINK',
default_value=False,
fail_if_not_found=False
)
# fix for other booleans:
if (isinstance(beta_reports_link, str) and
beta_reports_link.lower() in ['true','t','1']):
BETA_REPORTS_LINK = True
# Get email settings from environment
EMAIL_BACKEND = 'django_ses.SESBackend'
AWS_SES_ACCESS_KEY_ID = get_from_env('AWS_SES_ACCESS_KEY_ID')
......
......@@ -90,6 +90,8 @@ try:
except:
DB_SLEEP_FACTOR = 1.0
BETA_REPORTS_LINK = True
INSTANCE_STUB = """
<li>Phone alerts (calls/SMS) are {0}</li>
<li>Email alerts are {1}</li>
......
......@@ -128,5 +128,8 @@ def latest(request):
# Update form to have query and errors (if they exist)
context['form'] = form
# put in conditional for reports page:
context['beta_reports_link'] = getattr(settings,'BETA_REPORTS_LINK', False)
return render(request, 'search/latest.html', context=context)
......@@ -21,7 +21,9 @@
<h3 style="font-weight:lighter; text-align:center;">Latest as of {% now "j F Y H:i:s T" %} </h3>
<hr style="width:50%;text-align:center;margin:auto;">
{% if beta_reports_link %}
<p><h4 style="font-weight:lighter; text-align:center;"><span style="color:red;font-weight:bold;">New:</span> view the beta reports page located <a href="{% url "reports" %}">here</a></h4></p>
{% endif %}
<br>
<div class="row justify-content-md-center">
<div class="col-md-6 justify-content-center">
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment