Updated and more correct port finding.

This will handle the new style config file, the old style config file, and deployments where Galaxy is started with a completely different config file using the -c option.