views:

26

answers:

1

I have a sinatra service foo.rb

To run it I on a different port I would type "ruby foo.rb -p 5000".

While the program is running I would like to be able to get the port (in this case 5000) and other information. Is there a way to get info like this while the app is running?

Thanks

+1  A: 

You should be able to get to it with settings.port in any Sinatra action.

See this page for a list of all the built-in settings.

x1a4
This is correct, but I did not ask the question as clearly as I should have. I really needed the port from within a Sinatra::Base object. I have posted a new question here: http://stackoverflow.com/questions/2932750/from-sinatra-base-object-get-port-of-application-including-the-base-objectThanks for this answer though!
Poul