Refactoring database config