return localhost when host is 0.0.0.0 #1011

v3-stable
Karl Freeman 2014-02-17 09:28:57 +00:00 committed by Ben Hollis
parent 9932d0da84
commit f366325b3b
1 changed files with 11 additions and 3 deletions

View File

@ -21,9 +21,8 @@ module Middleman
@options = opts
mount_instance(new_app)
scheme = https? ? 'https' : 'http'
logger.info "== The Middleman is standing watch at #{scheme}://#{host}:#{port}"
logger.info "== Inspect your site configuration at #{scheme}://#{host}:#{port}/__middleman/"
logger.info "== The Middleman is standing watch at #{uri}"
logger.info "== Inspect your site configuration at #{uri + '__middleman'}"
@initialized ||= false
return if @initialized
@ -264,6 +263,15 @@ module Middleman
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
class FilteredWebrickLog < ::WEBrick::Log