Using 'Socket.gethostname' to get default hostname

As suggested by @bhollis in https://github.com/middleman/middleman/pull/665#issuecomment-10262763
This commit is contained in:
Kunal Parikh 2012-11-11 15:54:32 +11:00 committed by Thomas Reynolds
parent f6cf8de141
commit 6f8ada6639

View file

@ -3,7 +3,6 @@ require "webrick"
module Middleman module Middleman
module PreviewServer module PreviewServer
DEFAULT_HOST = '0.0.0.0'
DEFAULT_PORT = 4567 DEFAULT_PORT = 4567
class << self class << self
@ -14,7 +13,7 @@ module Middleman
# @return [void] # @return [void]
def start(opts={}) def start(opts={})
@options = opts @options = opts
@host = @options[:host] || DEFAULT_HOST @host = @options[:host] || Socket.gethostname
@port = @options[:port] || DEFAULT_PORT @port = @options[:port] || DEFAULT_PORT
mount_instance mount_instance