开发者

Sinatra programatically get port and other information about service

I have a sinatra service foo.rb

To run it I on a different 开发者_JAVA技巧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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜