refactor db configuration loading