Add ability to load configuration from the database

This is to support the dockerisation of the server.

Will also implement a full environment variables system in future.
Can we just log the stacktraces then?