Fixes #3569, #3210 - Use port from foreman_url for templates