refactor db config