Sinatra software receives ports and other information about services

I have a sinatra foo.rb service

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

While the program is running, I would like to get the port (in this case 5000) and other information. Is there any way to get this information while the application is running?

thank

+3
source share
1 answer

You can access it using settings.portany Sinatra action.

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

+5
source

Source: https://habr.com/ru/post/1747577/


All Articles