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:
parent
62d124f27a
commit
c1fc54a0fe
2 changed files with 13 additions and 13 deletions
|
@ -71,22 +71,22 @@ module Puma
|
||||||
# the rackup file, and set @app.
|
# the rackup file, and set @app.
|
||||||
#
|
#
|
||||||
def app
|
def app
|
||||||
if app = @options[:app]
|
app = @options[:app]
|
||||||
return app
|
|
||||||
end
|
|
||||||
|
|
||||||
path = @options[:rackup] || DefaultRackup
|
unless app
|
||||||
|
path = @options[:rackup] || DefaultRackup
|
||||||
|
|
||||||
unless File.exists?(path)
|
unless File.exists?(path)
|
||||||
raise "Missing rackup file '#{path}'"
|
raise "Missing rackup file '#{path}'"
|
||||||
end
|
end
|
||||||
|
|
||||||
app, options = Rack::Builder.parse_file path
|
app, options = Rack::Builder.parse_file path
|
||||||
@options.merge! options
|
@options.merge! options
|
||||||
|
|
||||||
options.each do |key,val|
|
options.each do |key,val|
|
||||||
if key.to_s[0,4] == "bind"
|
if key.to_s[0,4] == "bind"
|
||||||
@options[:binds] << val
|
@options[:binds] << val
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,6 @@ class TestConfigFile < Test::Unit::TestCase
|
||||||
|
|
||||||
app = conf.app
|
app = conf.app
|
||||||
|
|
||||||
assert_equal [200, {}, ["embedded app"]], app.call(nil)
|
assert_equal [200, {}, ["embedded app"]], app.call({})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue