Refactor database config manager