From c5f59dd02e1675929329482abf02ac2e391cb923 Mon Sep 17 00:00:00 2001 From: Sean Goedecke Date: Fri, 21 May 2021 02:19:52 +1000 Subject: [PATCH] Gracefully handle Rack not accepting CLI options (#2630) In https://github.com/rack/rack/commit/b95cb72463bac5a087294c7ecf94674db7aa41fe#diff-79892c6315a7f9c02489803e95ce828a8a32759b9f8f196aa98e6826eb562e55R96, Rack removed the ability to pass options from the command line. It now fails when you try to do that, and no longer exposes them from `Builder.load_file`. Puma shouldn't fail when this happens. This commit falls back to an empty object when Rack does not pass options back from `Builder.load_file`. --- lib/puma/configuration.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/puma/configuration.rb b/lib/puma/configuration.rb index a28777d63b..c25a891597 100644 --- a/lib/puma/configuration.rb +++ b/lib/puma/configuration.rb @@ -343,6 +343,8 @@ def load_rackup raise "Missing rackup file '#{rackup}'" unless File.exist?(rackup) rack_app, rack_options = rack_builder.parse_file(rackup) + rack_options = rack_options || {} + @options.file_options.merge!(rack_options) config_ru_binds = []