factoring database connection into config