public
Fork of bmizerany/sinatra
Description: Classy web-development dressed in a DSL
Homepage: http://sinatrarb.com
Clone URL: git://github.com/cschneid/sinatra.git
Add a host option to define the ip to bind to, defaults 0.0.0.0, which is code 
for 'all of them'
cschneid (author)
Wed Jun 04 16:06:08 -0700 2008
commit  c705cfde8a9244c168b78d17e2a87e00aa01bf76
tree    5e51803eccd69f0678cb52105744c8400df80b38
parent  ea3239c88f8a85f82cc891589bc6ad1c339719e8
0
lib/sinatra.rb 100644 →
...
108
109
110
 
 
 
 
111
112
113
...
127
128
129
130
 
131
132
133
...
896
897
898
 
899
900
901
...
108
109
110
111
112
113
114
115
116
117
...
131
132
133
 
134
135
136
137
...
900
901
902
903
904
905
906
0
@@ -108,6 +108,10 @@ module Sinatra
0
   def port
0
     application.options.port
0
   end
0
+
0
+  def host
0
+    application.options.host
0
+  end
0
   
0
   def env
0
     application.options.env
0
@@ -127,7 +131,7 @@ module Sinatra
0
     begin
0
       puts "== Sinatra has taken the stage on port #{port} for #{env} with backup by #{server.name}"
0
       require 'pp'
0
-      server.run(application, :Port => port) do |server|
0
+      server.run(application, {:Port => port, :Host => host}) do |server|
0
         trap(:INT) do
0
           server.stop
0
           puts "\n== Sinatra has ended his set (crowd applauds)"
0
@@ -896,6 +900,7 @@ module Sinatra
0
       @default_options = {
0
         :run => true,
0
         :port => 4567,
0
+        :host => '0.0.0.0',
0
         :env => :development,
0
         :root => root,
0
         :views => root + '/views',

Comments