diff --git a/History.md b/History.md index ce96413323..94e72bc609 100644 --- a/History.md +++ b/History.md @@ -39,6 +39,7 @@ * Fix `out_of_band` hook never executed if the number of worker threads is > 1 (#2177) * Fix ThreadPool#shutdown timeout accuracy (#2221) * Fix `UserFileDefaultOptions#fetch` to properly use `default` (#2233) + * Prefer the rackup file specified by the CLI (#2225) * Refactor * Remove unused loader argument from Plugin initializer (#2095) diff --git a/lib/puma/dsl.rb b/lib/puma/dsl.rb index 9bc51f77aa..41e03a1a7e 100644 --- a/lib/puma/dsl.rb +++ b/lib/puma/dsl.rb @@ -308,7 +308,7 @@ def debug # @example # rackup '/u/apps/lolcat/config.ru' def rackup(path) - @options[:rackup] = path.to_s + @options[:rackup] ||= path.to_s end def early_hints(answer=true) diff --git a/test/config/with_rackup_from_dsl.rb b/test/config/with_rackup_from_dsl.rb new file mode 100644 index 0000000000..3c310d8772 --- /dev/null +++ b/test/config/with_rackup_from_dsl.rb @@ -0,0 +1 @@ +rackup "test/rackup/hello-env.ru" diff --git a/test/test_integration_single.rb b/test/test_integration_single.rb index e1afa97f4d..864c3385ae 100644 --- a/test/test_integration_single.rb +++ b/test/test_integration_single.rb @@ -43,6 +43,17 @@ def test_term_suppress assert_equal 0, status end + def test_prefer_rackup_file_specified_by_cli + skip_unless_signal_exist? :TERM + + cli_server "-C test/config/with_rackup_from_dsl.rb test/rackup/hello.ru" + connection = connect + reply = read_body(connection) + _, status = stop_server + + assert_match("Hello World", reply) + end + def test_term_not_accepts_new_connections skip_unless_signal_exist? :TERM skip_on :jruby