I am deploying a RubyOnRails 3.1 app to heroku cedar stack. From within the app I would like to auto discover the host name (i.e. appname.herokuapp.com
). I have multiple deployments of the same app on heroku - some for development, some for staging and some for production. It would be nice to be able to check an environment variable or make some call to find out my app host name from within the app.
Asked
Active
Viewed 879 times
6

culix
- 10,188
- 6
- 36
- 52

bradgonesurfing
- 30,949
- 17
- 114
- 217
1 Answers
2
does
request.host
give you want you want?

John Beynon
- 37,398
- 8
- 88
- 97
-
No because the request object is not available at configuration time. – bradgonesurfing Sep 21 '11 at 13:26
-
ah, you missed that important point from your original question :) Your probably only solution will be set a config variable in each application and pick that up wherever you want to use it. The other option will be to make a call to the heroku api within your application to ask for the applications domain - I'd go with a config variable personally. – John Beynon Sep 21 '11 at 14:50
-
1@JohnBeynon I like the idea of setting a config var for each app and checking that. That works even if you use a custom domain. To make sure you get the rep, want to post your suggestion as an answer and see if brad will accept it? – culix Sep 06 '12 at 14:03