lib/rack/handler/thin.rb in rack-1.5.5 vs lib/rack/handler/thin.rb in rack-1.6.0.beta

- old
+ new

@@ -4,22 +4,28 @@ module Rack module Handler class Thin def self.run(app, options={}) - host = options.delete(:Host) || '0.0.0.0' + environment = ENV['RACK_ENV'] || 'development' + default_host = environment == 'development' ? 'localhost' : '0.0.0.0' + + host = options.delete(:Host) || default_host port = options.delete(:Port) || 8080 args = [host, port, app, options] # Thin versions below 0.8.0 do not support additional options args.pop if ::Thin::VERSION::MAJOR < 1 && ::Thin::VERSION::MINOR < 8 server = ::Thin::Server.new(*args) yield server if block_given? server.start end def self.valid_options + environment = ENV['RACK_ENV'] || 'development' + default_host = environment == 'development' ? 'localhost' : '0.0.0.0' + { - "Host=HOST" => "Hostname to listen on (default: localhost)", + "Host=HOST" => "Hostname to listen on (default: #{default_host})", "Port=PORT" => "Port to listen on (default: 8080)", } end end end