lib/rack/handler/puma.rb in piesync-puma-3.12.6.1 vs lib/rack/handler/puma.rb in piesync-puma-5.4.0.1
- old
+ new
@@ -1,5 +1,7 @@
+# frozen_string_literal: true
+
require 'rack/handler'
module Rack
module Handler
module Puma
@@ -26,13 +28,12 @@
default_options[k] = options.delete(k)
end
end
conf = ::Puma::Configuration.new(options, default_options) do |user_config, file_config, default_config|
- user_config.quiet
-
if options.delete(:Verbose)
+ require 'rack/common_logger'
app = Rack::CommonLogger.new(app, STDOUT)
end
if options[:environment]
user_config.environment options[:environment]
@@ -57,13 +58,11 @@
user_config.app app
end
conf
end
-
-
- def self.run(app, options = {})
+ def self.run(app, **options)
conf = self.config(app, options)
events = options.delete(:Silent) ? ::Puma::Events.strings : ::Puma::Events.stdio
launcher = ::Puma::Launcher.new(conf, :events => events)
@@ -84,10 +83,10 @@
"Port=PORT" => "Port to listen on (default: 8080)",
"Threads=MIN:MAX" => "min:max threads to use (default 0:16)",
"Verbose" => "Don't report each request (default: false)"
}
end
- private
+
def self.set_host_port_to_config(host, port, config)
config.clear_binds! if host || port
if host && (host[0,1] == '.' || host[0,1] == '/')
config.bind "unix://#{host}"