Skip to content
Snippets Groups Projects
Commit 68548f4b authored by Bjarke Madsen's avatar Bjarke Madsen
Browse files

perform workaround for sphinx calling _create_app with no config

parent d7efabca
No related branches found
No related tags found
No related merge requests found
...@@ -37,15 +37,6 @@ def _create_app(app_config) -> Flask: ...@@ -37,15 +37,6 @@ def _create_app(app_config) -> Flask:
app = Flask(__name__) app = Flask(__name__)
CORS(app) CORS(app)
app.config['CONFIG_PARAMS'] = app_config
app.config['SECRET_KEY'] = app_config['SECRET_KEY']
app.config['SESSION_COOKIE_SECURE'] = True
if 'oidc' not in app_config:
app.config['LOGIN_DISABLED'] = True
logger.info('No OIDC configuration found, authentication disabled')
else:
logger.info('OIDC configuration found, authentication will be enabled')
from compendium_v2.routes import default from compendium_v2.routes import default
app.register_blueprint(default.routes, url_prefix='/') app.register_blueprint(default.routes, url_prefix='/')
...@@ -55,6 +46,19 @@ def _create_app(app_config) -> Flask: ...@@ -55,6 +46,19 @@ def _create_app(app_config) -> Flask:
from compendium_v2.routes import api from compendium_v2.routes import api
app.register_blueprint(api.routes, url_prefix='/api') app.register_blueprint(api.routes, url_prefix='/api')
if not app_config:
# workaround for sphinx causing app to be created, but not loading a config
return app
app.config['CONFIG_PARAMS'] = app_config
app.config['SECRET_KEY'] = app_config['SECRET_KEY']
app.config['SESSION_COOKIE_SECURE'] = True
if 'oidc' not in app_config:
app.config['LOGIN_DISABLED'] = True
logger.info('No OIDC configuration found, authentication disabled')
else:
logger.info('OIDC configuration found, authentication will be enabled')
return app return app
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment