DRY out load_connection_file implementations

We currently have three (slightly) different implementations of
load_connection_file. This PR unifies them to one.