From 3f3b43a71afdb865b98e5bfcaa51289d83737a86 Mon Sep 17 00:00:00 2001
From: Benjamin Bertrand <benjamin.bertrand@esss.se>
Date: Fri, 25 May 2018 14:38:09 +0200
Subject: [PATCH] Allow to easily identify staging server

Change "CSentry" to "CSEntry-test" in the navbar (upper left corner)
and set it to red on the staging server.

This is done by setting the variable CSENTRY_STAGING to True in the
settings.cfg file for the staging server (variable set to False by
default).

JIRA INFRA-347
---
 app/settings.py         | 1 +
 app/templates/base.html | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/app/settings.py b/app/settings.py
index d1247e2..b797c5b 100644
--- a/app/settings.py
+++ b/app/settings.py
@@ -66,6 +66,7 @@ TEMPORARY_ICS_ID = 'ZZ'
 MAC_OUI = '02:42:42'
 
 DOCUMENTATION_URL = 'http://ics-infrastructure.pages.esss.lu.se/csentry/index.html'
+CSENTRY_STAGING = False
 
 # AWX job templates
 AWX_CORE_SERVICES_UPDATE = 'ics-ans-core @ DHCP test'
diff --git a/app/templates/base.html b/app/templates/base.html
index 729631d..158126a 100644
--- a/app/templates/base.html
+++ b/app/templates/base.html
@@ -15,7 +15,8 @@
 {% block navbar %}
   <!-- Fixed navbar -->
   <div class="navbar fixed-top navbar-expand-lg navbar-light bg-light" role="navigation">
-      <a class="navbar-brand" href="{{ url_for('main.index') }}">CSEntry</a>
+    <a class="navbar-brand{% if config['CSENTRY_STAGING'] %} text-danger{% endif %}"
+       href="{{ url_for('main.index') }}">CSEntry{% if config['CSENTRY_STAGING'] %}-test{% endif %}</a>
       <button class="navbar-toggler" type="button" data-toggle="collapse"
               data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent"
               aria-expanded="false" aria-label="Toggle navigation">
-- 
GitLab