Extract parsoid host and pagebundle retrieval

This is part of a general effort to refactor the code, with an eye
toward both configurability and modularity.