6

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.

1 Answer 1

2

does

request.host

give you want you want?

3
  • No because the request object is not available at configuration time. Sep 21, 2011 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. Sep 21, 2011 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 6, 2012 at 14:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.