Cache values from the configuration service which are used within the loop.

Particularly on installations with many routes, there's no need to hit the configuration service twice for every route; we can fetch the values once outside the iterator and save them there.