diff --git a/Makefile b/Makefile index bc9fbf70..d9d1ae2c 100644 --- a/Makefile +++ b/Makefile @@ -25,7 +25,7 @@ up: $(MAKE) init-db @echo "Empty database initialized. Run dump-restore to fill it by production dump." restart: - $(MAKE) halt && $(call compose-tool) up -d + $(MAKE) halt && $(MAKE) up halt: $(call compose-tool) down -t1 bash-web: diff --git a/anitya/app.py b/anitya/app.py index 89fdee8f..785fac3a 100644 --- a/anitya/app.py +++ b/anitya/app.py @@ -75,7 +75,7 @@ def create(config=None): # Debug related initialization # WARNING: For debug and development purpose only - if app.debug: # pragma: no cover + if anitya_config["DEBUG"]: # pragma: no cover app.register_blueprint(debug.debug_blueprint) oauth = OAuth(app) diff --git a/anitya/config.py b/anitya/config.py index 47e005d3..7d2865db 100644 --- a/anitya/config.py +++ b/anitya/config.py @@ -37,6 +37,8 @@ SECRET_KEY="changeme please", # URL to the database DB_URL="sqlite:////var/tmp/anitya-dev.sqlite", + # DEBUG mode + DEBUG=False, # List of admins based on their openid ANITYA_WEB_ADMINS=[], ADMIN_EMAIL="admin@fedoraproject.org", diff --git a/anitya/templates/login.html b/anitya/templates/login.html index 2359cda3..fe93f388 100644 --- a/anitya/templates/login.html +++ b/anitya/templates/login.html @@ -11,14 +11,4 @@ {% endfor %} -{% if config["DEBUG"] %} -
-{% endif %} {% endblock %} diff --git a/anitya/templates/login_debug.html b/anitya/templates/login_debug.html new file mode 100644 index 00000000..1ea1df5c --- /dev/null +++ b/anitya/templates/login_debug.html @@ -0,0 +1,14 @@ +{% extends "master.html" %} + +{% block title %}Login ยท Anitya{% endblock %} + +{% block body %} + +{% endblock %} diff --git a/anitya/tests/test_config.py b/anitya/tests/test_config.py index b045757d..6c809f37 100644 --- a/anitya/tests/test_config.py +++ b/anitya/tests/test_config.py @@ -117,6 +117,7 @@ def test_full_config_file(self, mock_exists, mock_log): "SECRET_KEY": "very_secret", "PERMANENT_SESSION_LIFETIME": timedelta(seconds=3600), "DB_URL": "sqlite:////var/tmp/anitya-dev.sqlite", + "DEBUG": False, "ANITYA_WEB_ADMINS": ["http://pingou.id.fedoraproject.org"], "ADMIN_EMAIL": "admin@fedoraproject.org", "ANITYA_LOG_CONFIG": { diff --git a/anitya/ui.py b/anitya/ui.py index 8a3df5b8..b345551e 100644 --- a/anitya/ui.py +++ b/anitya/ui.py @@ -57,6 +57,8 @@ def login(): next_url = "/" flask.session["next_url"] = next_url + if anitya_config["DEBUG"]: # pragma: no cover + return flask.render_template("login_debug.html") return flask.render_template("login.html") diff --git a/files/anitya.toml.sample b/files/anitya.toml.sample index 183412e4..71a11b05 100644 --- a/files/anitya.toml.sample +++ b/files/anitya.toml.sample @@ -12,6 +12,9 @@ permanent_session_lifetime = 3600 # URL to the database db_url = "sqlite:////var/tmp/anitya-dev.sqlite" +# Anitya DEBUG mode +debug = false + # List of web administrators. The values should be the value of the "id" column # for the user in the "users" table of the database. They need to log in before # this record is created. An example value would be