Skip to content

Commit 02623a6

Browse files
committed
Show unstable features warning on staging instance
Signed-off-by: Keshav Priyadarshi <[email protected]>
1 parent 5b36399 commit 02623a6

File tree

4 files changed

+34
-7
lines changed

4 files changed

+34
-7
lines changed

docs/source/installation.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,10 @@ to run on a different port than 8000.
8484
are several steps that may be needed to secure such a deployment.
8585
Currently, this is not recommendend.
8686

87+
.. tip::
88+
89+
Set ``STAGING`` to ``False`` in production to disable the staging environment warning.
90+
8791
Execute a Command
8892
^^^^^^^^^^^^^^^^^
8993

vulnerabilities/templates/navbar.html

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
11
{% load utils %}
22

3-
<nav class="navbar is-dark mb-5 border-bottom-radius" role="navigation" aria-label="main navigation">
3+
4+
{% if STAGING %}
5+
<div class="notification is-danger has-text-centered is-fixed-top my-0" style="border-radius: 0;">
6+
<span class="icon">
7+
<i class="fa fa-exclamation-triangle"></i>
8+
</span>
9+
<strong> Staging Environment:</strong>
10+
Content and features may be unstable or change without notice.
11+
</div>
12+
{% endif %}
13+
14+
<nav class="navbar is-dark mb-5 border-bottom-radius" role="navigation" aria-label="main navigation"
15+
style="border-radius: 0;">
416
<div class="navbar-brand ml-3">
517
<a class="navbar-item is-size-4 has-text-weight-bold {% active_item 'home' %}" href="{% url 'home' %}">
618
VulnerableCode<span class="nexb-orange">.</span>io
@@ -29,26 +41,27 @@
2941
<div class="navbar-item navbar-item is-cursor-help">
3042
<div class="dropdown is-right is-hoverable ">
3143
<div class="dropdown-trigger has-text-grey-light">About</div>
32-
<div class="dropdown-menu navbar-hover-div" role="menu">
44+
<div class="dropdown-menu navbar-hover-div" role="menu">
3345
<div class="dropdown-content">
3446
<div class="dropdown-item about-hover-div">
3547

3648
VulnerableCode is a free and open database of software package vulnerabilities.
3749
<ul>
3850
<li>
3951
Live chat at <a href="https://gitter.im/aboutcode-org/vulnerablecode">
40-
https://gitter.im/aboutcode-org/vulnerablecode</a>
52+
https://gitter.im/aboutcode-org/vulnerablecode</a>
4153
</li>
4254
<li>
43-
Source code and support at <a href="https://github.com/nexB/vulnerablecode">https://github.com/nexB/vulnerablecode</a>
55+
Source code and support at <a
56+
href="https://github.com/nexB/vulnerablecode">https://github.com/nexB/vulnerablecode</a>
4457
</li>
4558
<li>
46-
Docs at <a href=https://vulnerablecode.readthedocs.org/>
59+
Docs at <a href=https://vulnerablecode.readthedocs.org />
4760
https://vulnerablecode.readthedocs.org/</a>
4861
</li>
4962
<li>
5063
Sponsored by NLnet <a href="https://nlnet.nl/project/vulnerabilitydatabase/">
51-
https://nlnet.nl/project/vulnerabilitydatabase/</a> for
64+
https://nlnet.nl/project/vulnerabilitydatabase/</a> for
5265
<a href="https://www.aboutcode.org/">https://www.aboutcode.org/</a>
5366
</li>
5467
</ul>
@@ -59,7 +72,7 @@
5972
</div>
6073
<div class="navbar-item navbar-item is-cursor-help">
6174
<div class="dropdown-trigger has-text-grey-light">
62-
v{{ VULNERABLECODE_VERSION }}
75+
v{{ VULNERABLECODE_VERSION }}
6376
</div>
6477
</div>
6578
</div>

vulnerablecode/context_processors.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,16 @@
77
# See https://aboutcode.org for more information about nexB OSS projects.
88
#
99

10+
from django.conf import settings
11+
1012
from vulnerablecode import __version__ as vulnerablecode_version
1113

1214

1315
def versions(request):
1416
return {
1517
"VULNERABLECODE_VERSION": vulnerablecode_version,
1618
}
19+
20+
21+
def staging(request):
22+
return {"STAGING": getattr(settings, "STAGING")}

vulnerablecode/settings.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@
5151
# SECURITY WARNING: do not run with debug turned on in production
5252
DEBUG_UI = env.bool("VULNERABLECODE_DEBUG_UI", default=False)
5353

54+
# WARNING: Set this to False in production
55+
STAGING = env.bool("STAGING", default=True)
56+
5457
EMAIL_BACKEND = "django.core.mail.backends.smtp.EmailBackend"
5558
EMAIL_HOST = env.str("EMAIL_HOST", default="")
5659
EMAIL_USE_TLS = True
@@ -139,6 +142,7 @@
139142
"django.template.context_processors.request",
140143
"django.template.context_processors.static",
141144
"vulnerablecode.context_processors.versions",
145+
"vulnerablecode.context_processors.staging",
142146
],
143147
},
144148
},

0 commit comments

Comments
 (0)