Retrieve host info in Rake task?

Hi,

I’m writing a rake task for a standard Rails 3.x project
(lib/tasks/myexport.rake).
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 ?