title: Set host name as an environment variable in Heroku review app
body: <p>I'm using the Review Apps feature integrated with Github on Heroku. In one of my apps, I set an environment variable called <code>HOST_NAME</code> . For example, if the site is <a href="http://www.purplebinder.com" rel="noreferrer">http://www.purplebinder.com</a>, then <code>HOST_NAME</code> would be set to <code>www.purplebinder.com</code>. It's used in a couple of places where we work with cookies and in our transactional emails.</p>
  
  <p>When I open up a new pull request and spin up a review app, <code>HOST_NAME</code> should be something like <code>purplebinder-pr-27.herokuapp.com</code>.</p>
  
  <p>Is there a way to set this value automatically? The <a href="https://devcenter.heroku.com/articles/github-integration-review-apps" rel="noreferrer">Heroku documentation on review apps</a> says an env var can inherit a value from the parent app or be hardcoded in <code>app.json</code>. Neither of those approaches work here, because the value needs to be different each time, and also different from the parent app.</p>
  
  <p>Heroku also says an env var can be set "through a generator", but doesn't go into detail about what that is.</p>
  
  <p>This question might be a duplicate of <a href="https://stackoverflow.com/questions/35254039/setting-root-url-for-review-apps">Setting ROOT_URL for Review Apps</a>, but nobody answered that one. It's also similar to <a href="https://stackoverflow.com/questions/12570579/how-to-get-heroku-app-name-url-from-inside-the-app">How to get Heroku app name from inside the app</a>, but the answers there involved running a script after the app was created - here I'd like to set this value as part of the initial build.</p>