changeset 8336:75e46ebf176d

middleware: verify as early as possible in app initialization that the necessary configuration is provided In addition to verifying a random config setting, also verify that config has been read as Paste does it, an invariant introduced in 488b52cad890.
author Mads Kiilerich <mads@kiilerich.com>
date Tue, 31 Mar 2020 17:43:31 +0200
parents 80ffe0f29857
children c33d3aa26c19
files kallithea/config/middleware.py
diffstat 1 files changed, 2 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/config/middleware.py	Fri Apr 10 15:18:45 2020 +0200
+++ b/kallithea/config/middleware.py	Tue Mar 31 17:43:31 2020 +0200
@@ -42,4 +42,6 @@
     ``app_conf`` contains all the application-specific settings (those defined
     under ``[app:main]``.
     """
+    assert app_conf.get('sqlalchemy.url')  # must be called with a Kallithea .ini file, which for example must have this config option
+    assert global_conf.get('here') and global_conf.get('__file__')  # app config should be initialized the paste way ...
     return make_base_app(global_conf, full_stack=full_stack, **app_conf)