mirror of
https://github.com/puma/puma.git
synced 2022-11-09 13:48:40 -05:00
Fix Puma with rails server
The "default" thread in the handler was interpreted as canonical and took precedence over the `config/puma.rb` file. Fixed by using defaults already present in `configuration.rb` which is used by the Launcher. We only advertise `Puma.cli_config` when puma is set via the cli. Not sure why but if `cli.rb` hasn't been loaded then we don't need to run that code. Moving requires to Launcher so it can be called as a standalone file (otherwise we get require errors).
This commit is contained in:
parent
d2b73650a9
commit
36711207e8
3 changed files with 16 additions and 20 deletions
|
@ -1,17 +1,6 @@
|
|||
require 'optparse'
|
||||
require 'uri'
|
||||
|
||||
require 'puma/server'
|
||||
require 'puma/const'
|
||||
require 'puma/configuration'
|
||||
require 'puma/binder'
|
||||
require 'puma/detect'
|
||||
require 'puma/daemon_ext'
|
||||
require 'puma/util'
|
||||
require 'puma/single'
|
||||
require 'puma/cluster'
|
||||
|
||||
require 'puma/commonlogger'
|
||||
require 'puma/launcher'
|
||||
|
||||
module Puma
|
||||
|
|
|
@ -1,4 +1,14 @@
|
|||
require 'puma/binder'
|
||||
require 'puma/server'
|
||||
require 'puma/const'
|
||||
require 'puma/configuration'
|
||||
require 'puma/binder'
|
||||
require 'puma/detect'
|
||||
require 'puma/daemon_ext'
|
||||
require 'puma/util'
|
||||
require 'puma/single'
|
||||
require 'puma/cluster'
|
||||
|
||||
require 'puma/commonlogger'
|
||||
|
||||
module Puma
|
||||
# Puam::Launcher is the single entry point for starting a Puma server based on user
|
||||
|
@ -56,7 +66,7 @@ module Puma
|
|||
@config = Puma::Configuration.new(input_options)
|
||||
|
||||
# Advertise the Configuration
|
||||
Puma.cli_config = @config
|
||||
Puma.cli_config = @config if defined?(Puma.cli_config)
|
||||
|
||||
@config.load
|
||||
|
||||
|
|
|
@ -5,11 +5,8 @@ module Rack
|
|||
module Handler
|
||||
module Puma
|
||||
DEFAULT_OPTIONS = {
|
||||
:Host => '0.0.0.0',
|
||||
:Port => 8080,
|
||||
:Threads => '0:16',
|
||||
:Verbose => false,
|
||||
:Silent => false
|
||||
:Silent => false
|
||||
}
|
||||
|
||||
def self.run(app, options = {})
|
||||
|
@ -23,9 +20,9 @@ module Rack
|
|||
ENV['RACK_ENV'] = options[:environment].to_s
|
||||
end
|
||||
|
||||
options[:binds] ||= []
|
||||
options[:binds] << "tcp://#{ options.delete(:Host) }:#{ options.delete(:Port) }"
|
||||
options[:min_threads], options[:max_threads] = options.delete(:Threads).split(':', 2)
|
||||
if options[:Threads]
|
||||
options[:min_threads], options[:max_threads] = options.delete(:Threads).split(':', 2)
|
||||
end
|
||||
options[:app] = app
|
||||
events = options.delete(:Silent) ? ::Puma::Events.strings : ::Puma::Events.stdio
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue