diff --git a/lib/puma/cli.rb b/lib/puma/cli.rb index 7aafdb99fc..39be51d1f2 100644 --- a/lib/puma/cli.rb +++ b/lib/puma/cli.rb @@ -83,6 +83,14 @@ def unsupported(str) raise UnsupportedOption end + def configure_control_url(command_line_arg) + if command_line_arg + @control_url = command_line_arg + elsif Puma.jruby? + unsupported "No default url available on JRuby" + end + end + # Build the OptionParser object to handle the available options. # @@ -97,13 +105,15 @@ def setup_options file_config.load arg end - o.on "--control URL", "The bind url to use for the control server", - "Use 'auto' to use temp unix server" do |arg| - if arg - @control_url = arg - elsif Puma.jruby? - unsupported "No default url available on JRuby" - end + control_url_desc = "The bind url to use for the control server. Use 'auto' to use temp unix server" + + o.on "--control-url URL", control_url_desc do |arg| + configure_control_url(arg) + end + + # alias --control-url for backwards-compatibility + o.on "--control URL", control_url_desc do |arg| + configure_control_url(arg) end o.on "--control-token TOKEN",