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
parent 1761197af3
commit e57564c957

View file

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