1
0
Fork 0
mirror of https://github.com/puma/puma.git synced 2022-11-09 13:48:40 -05:00

Handle a config-based app properly

This commit is contained in:
Evan Phoenix 2013-02-06 14:44:51 -08:00
parent 62d124f27a
commit c1fc54a0fe
2 changed files with 13 additions and 13 deletions

View file

@ -71,22 +71,22 @@ module Puma
# the rackup file, and set @app.
#
def app
if app = @options[:app]
return app
end
app = @options[:app]
path = @options[:rackup] || DefaultRackup
unless app
path = @options[:rackup] || DefaultRackup
unless File.exists?(path)
raise "Missing rackup file '#{path}'"
end
unless File.exists?(path)
raise "Missing rackup file '#{path}'"
end
app, options = Rack::Builder.parse_file path
@options.merge! options
app, options = Rack::Builder.parse_file path
@options.merge! options
options.each do |key,val|
if key.to_s[0,4] == "bind"
@options[:binds] << val
options.each do |key,val|
if key.to_s[0,4] == "bind"
@options[:binds] << val
end
end
end

View file

@ -11,6 +11,6 @@ class TestConfigFile < Test::Unit::TestCase
app = conf.app
assert_equal [200, {}, ["embedded app"]], app.call(nil)
assert_equal [200, {}, ["embedded app"]], app.call({})
end
end