Improving the custom middleware to read DB info from the app's config file(s).