Move db config to api module and add tests