Skip to content

Commit

Permalink
Switch test-site reminder to use existing variables
Browse files Browse the repository at this point in the history
  • Loading branch information
haydngreatnews committed Jun 26, 2024
1 parent 7814124 commit 6dac77e
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 18 deletions.
7 changes: 3 additions & 4 deletions cdhweb/context_processors.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ def favicon_path():

return "".join([settings.STATIC_URL, base_path, icon_version])

def environment(request):
return {
'ENVIRONMENT': settings.ENVIRONMENT
}

def show_test_warning(request):
return {"SHOW_TEST_WARNING": getattr(settings, "SHOW_TEST_WARNING", False)}
4 changes: 2 additions & 2 deletions cdhweb/settings/components/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@
"cdhweb.context_processors.template_settings",
"cdhweb.pages.context_processors.page_intro",
"cdhweb.pages.context_processors.site_search",
"cdhweb.context_processors.environment"
"cdhweb.context_processors.show_test_warning",
],
},
},
Expand Down Expand Up @@ -451,4 +451,4 @@

# Springkit Settings
BILINGUAL_HEADINGS = False
BILINGUAL_LINKS = False
BILINGUAL_LINKS = False
4 changes: 0 additions & 4 deletions cdhweb/settings/environments/development.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
import os

DEBUG = True

ALLOWED_HOSTS = ["*"]

ENVIRONMENT = os.getenv('ENVIRONMENT', 'development')
4 changes: 1 addition & 3 deletions cdhweb/settings/environments/test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import os

from cdhweb.settings import BASE_DIR, DATABASES
from cdhweb.settings import DATABASES

# These settings correspond to the service container settings in the
# .github/workflow .yml files.
Expand All @@ -24,5 +24,3 @@

# override software version to avoid creating visual diffs in display
SW_VERSION = "CI Build"

ENVIRONMENT = os.getenv('ENVIRONMENT', 'test')
2 changes: 0 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ services:
- ".:/app"
ports:
- "${PORT_PREFIX:-561}80:8000"
env_file:
- .env
environment:
VIRTUAL_HOST: "cdh.dev.springload.nz"
VIRTUAL_PORT: 8000
Expand Down
6 changes: 3 additions & 3 deletions templates/includes/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
{% secondary_navigation as secondary_nav %}

<header class="header">
{% site_alerts %}
{% site_alerts %}

{% if ENVIRONMENT != 'production' and ENVIRONMENT != 'development' %}
{% if SHOW_TEST_WARNING %}
<div style="background-color: yellow; text-align: center; padding: 10px;">
This is a test site.
</div>
Expand Down Expand Up @@ -67,7 +67,7 @@
<a href="{{ secondary_nav.cta_button.link_url }}" class="sk-btn sk-btn--secondary main-nav-desktop__cta">{{ secondary_nav.cta_button.title }}</a>
</li>
{% endif %}
</ul>
</ul>

</div>
</nav>
Expand Down

0 comments on commit 6dac77e

Please sign in to comment.