return localhost when host is 0.0.0.0 #1011

This commit is contained in:
Karl Freeman 2014-02-17 09:28:57 +00:00 committed by Ben Hollis
parent 9932d0da84
commit f366325b3b

View file

@ -21,9 +21,8 @@ module Middleman
@options = opts @options = opts
mount_instance(new_app) mount_instance(new_app)
scheme = https? ? 'https' : 'http' logger.info "== The Middleman is standing watch at #{uri}"
logger.info "== The Middleman is standing watch at #{scheme}://#{host}:#{port}" logger.info "== Inspect your site configuration at #{uri + '__middleman'}"
logger.info "== Inspect your site configuration at #{scheme}://#{host}:#{port}/__middleman/"
@initialized ||= false @initialized ||= false
return if @initialized return if @initialized
@ -264,6 +263,15 @@ module Middleman
end end
end end
end end
# Returns the URI the preview server will run on
# @return [URI]
def uri
host = @host.eql?('0.0.0.0') ? 'localhost' : @host
scheme = https? ? 'https' : 'http'
URI("#{scheme}://#{host}:#{@port}")
end
end end
class FilteredWebrickLog < ::WEBrick::Log class FilteredWebrickLog < ::WEBrick::Log