Skip to content
Snippets Groups Projects
Commit 47cb4d8d authored by Erik Reid's avatar Erik Reid
Browse files

conditionally enable testing/ routes

... only if ENABLE_TESTING_ROUTES is defined in the environment
parent 092b1d8d
No related branches found
No related tags found
No related merge requests found
......@@ -14,6 +14,10 @@ def create_app():
:return: a new flask app instance
"""
if "SETTINGS_FILENAME" not in os.environ:
assert False, \
"environment variable SETTINGS_FILENAME' must be defined"
app = Flask(__name__)
app.secret_key = "super secret session key"
......@@ -35,12 +39,10 @@ def create_app():
from inventory_provider.routes import poller
app.register_blueprint(poller.routes, url_prefix='/poller')
from inventory_provider.routes import testing
app.register_blueprint(testing.routes, url_prefix='/testing')
if "SETTINGS_FILENAME" not in os.environ:
assert False, \
"environment variable SETTINGS_FILENAME' must be defined"
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"])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment