remove some hardcoded 'localhost's from dev environment (PR #14801)

Trying to use a local test hostname other than localhost (e.g. discourse.test )for discourse development was difficult due the fact that localhost was hardcoded in a few places. This patch uses existing environment variables to allow a developer to use a different domain when developing.

GitHub

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

This looks good to me :+1: Thank you for your contribution.