Fixes #8290 - dry up foreman_url logic in one place

depends on https://github.com/theforeman/foreman/pull/1902