From 3e8f13dfd16b213e1f63d30628df225eeb1d032f Mon Sep 17 00:00:00 2001 From: Kevin Chung Date: Sun, 25 Nov 2018 13:11:31 -0500 Subject: [PATCH] Add SAFE_MODE concept to let tests run without plugins (#753) * Adds a `SAFE_MODE` config to disable the loading of plugins. --- CTFd/__init__.py | 3 ++- CTFd/config.py | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CTFd/__init__.py b/CTFd/__init__.py index c2212dec..11811bb2 100644 --- a/CTFd/__init__.py +++ b/CTFd/__init__.py @@ -189,6 +189,7 @@ def create_app(config='CTFd.config.Config'): app.register_error_handler(500, general_error) app.register_error_handler(502, gateway_error) - init_plugins(app) + if app.config.get('SAFE_MODE', False): + init_plugins(app) return app diff --git a/CTFd/config.py b/CTFd/config.py index 8b3ef624..f71c1f3f 100644 --- a/CTFd/config.py +++ b/CTFd/config.py @@ -210,3 +210,4 @@ class TestingConfig(Config): UPDATE_CHECK = False REDIS_URL = None CACHE_TYPE = 'simple' + SAFE_MODE = True