Refactored sharding and persistence config into a separate code module