From a9719568c4c5457ad241f6fdc35c642e20af7810 Mon Sep 17 00:00:00 2001
From: Erik Reid <erik.reid@geant.org>
Date: Sat, 9 Feb 2019 15:49:33 +0100
Subject: [PATCH] read ENABLE_TEST_ROUTES flag from flask settings

was previously read from the environment
---
 inventory_provider/__init__.py | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/inventory_provider/__init__.py b/inventory_provider/__init__.py
index ed7d1c17..3307321e 100644
--- a/inventory_provider/__init__.py
+++ b/inventory_provider/__init__.py
@@ -39,11 +39,6 @@ def create_app():
     from inventory_provider.routes import poller
     app.register_blueprint(poller.routes, url_prefix='/poller')
 
-    if "ENABLE_TESTING_ROUTES" in os.environ:
-        from inventory_provider.routes import testing
-        app.register_blueprint(testing.routes, url_prefix='/testing')
-        logging.warning('DANGER!!! testing routes enabled')
-
     logging.info("initializing Flask with config from: %r"
                  % os.environ["SETTINGS_FILENAME"])
     app.config.from_envvar("SETTINGS_FILENAME")
@@ -56,6 +51,11 @@ def create_app():
         "config file '%s' not found" %
         app.config["INVENTORY_PROVIDER_CONFIG_FILENAME"])
 
+    if app.config.get('ENABLE_TESTING_ROUTES', False):
+        from inventory_provider.routes import testing
+        app.register_blueprint(testing.routes, url_prefix='/testing')
+        logging.warning('DANGER!!! testing routes enabled')
+
     from inventory_provider import config
     with open(app.config["INVENTORY_PROVIDER_CONFIG_FILENAME"]) as f:
         # test the config file can be loaded
-- 
GitLab