From 7b27d0dd4ef68ed8cf82bd7141b0b677fa43ba19 Mon Sep 17 00:00:00 2001 From: Dimitri Huisman Date: Mon, 5 Oct 2020 09:26:50 +0000 Subject: [PATCH] When selecting a non-stable version, add a message this is version is "only for testing". The stable version is set via the new environment variable stable_version. E.g. stable_version=1.7 --- setup/server.py | 5 ++++- setup/templates/base.html | 12 ++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/setup/server.py b/setup/server.py index b2ca2175..0d58fa25 100644 --- a/setup/server.py +++ b/setup/server.py @@ -53,7 +53,10 @@ def build_app(path): @app.context_processor def app_context(): - return dict(versions=os.getenv("VERSIONS","master").split(',')) + return dict( + versions=os.getenv("VERSIONS","master").split(','), + stable_version = os.getenv("stable_version", "master") + ) prefix_bp = flask.Blueprint(version, __name__) prefix_bp.jinja_loader = jinja2.ChoiceLoader([ diff --git a/setup/templates/base.html b/setup/templates/base.html index c53bd1d1..5752e91f 100644 --- a/setup/templates/base.html +++ b/setup/templates/base.html @@ -8,13 +8,21 @@

Mailu configuration

Version - {% for module in versions %} - + {% endfor %}

+ {% if version != stable_version %} + {% call macros.panel("danger", "You have not selected the stable version") %} +You have not selected the stable version. The stable version is {{ stable_version }}. +The selected version can be used for testing and reporting bugs. +For production scenarios we recommend to use the stable version. + {% endcall %} + {% endif %} + {% block page %}{% endblock %}