Retrieve host info in Rake task ?


I'm writing a rake task for a standard Rails 3.x project. I'd like to retrieve a info from rails about project's hostname and if possible also about protocol (http, https) and default port.

I can access these values from a controller f.E. but what about rake task ?