Open
Description
For people using the default configuration which is present in the repository, mistakenly or not, they would end up using an in-memory database. The application would start, no problem - but performing any path operation would result in referencing tables that do not exist, thereby causing an error and an exception message which is not very elegant.
(venv) [t0xic0der@fedorable duffy]$ duffy -c etc/duffy-example-config.yaml serve
* Starting Duffy...
* Host address : 127.0.0.1
* Port number : 8080
* Log level : warning
* Serving API docs on http://127.0.0.1:8080/docs
ERROR: Exception in ASGI application
Traceback (most recent call last):
File "/home/t0xic0der/Projects/duffy/venv/lib64/python3.10/site-packages/sqlalchemy/engine/base.py", line 1802, in _execute_context
self.dialect.do_execute(
File "/home/t0xic0der/Projects/duffy/venv/lib64/python3.10/site-
.
.
<SOME MORE HUNDREDS OF BROWSER-CRASH-INDUCING LINES OF UNINDICATIVE EXCEPTION MESSAGE>
What do we do then?
Simple, we repurpose the code from here #132 to inspect the database that the config file points towards. If we do not find them the way we want them to - i.e. if it does not have the columns of the names and the types we are looking for, we do NOT start the application.