Search code examples
ruby-on-railsrack

How to tell which port Rails is running on in an initializer


Is there a way to tell which port a Rails application (or a generic Rack app) is running on in an initializer ?

I would like to be able to load a different configuration based on the port or the host name, in order to connect to a host-specific FaceBook application.

I'm using Rails 2.3.5.


Solution

  • Based on the lack of answers here and this thread on rubyforum: http://www.ruby-forum.com/topic/196017#new , I think that there probably isn't a standard way to tell the port.