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.
How to discover the *external* hostname from within a heroku cedar application
does
request.host
give you want you want?
No because the request object is not available at configuration time. –
Berne
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. –
Absentee
@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? –
Diplomatic
© 2022 - 2024 — McMap. All rights reserved.