1
0
Fork 0
mirror of https://github.com/puma/puma.git synced 2022-11-09 13:48:40 -05:00

Add ability for plugins to alter the config on load

This commit is contained in:
Evan Phoenix 2016-02-06 23:10:48 -08:00
parent 663666c5b7
commit 541393ebf9
4 changed files with 14 additions and 3 deletions

View file

@ -204,7 +204,7 @@ module Puma
o.banner = "puma <options> <rackup file>" o.banner = "puma <options> <rackup file>"
o.on_tail "-h", "--help", "Show help" do o.on_tail "-h", "--help", "Show help" do
log o $stdout.puts o
exit 0 exit 0
end end
end end

View file

@ -12,7 +12,7 @@ module Puma
options options
end end
def initialize(config, options) def initialize(options, config)
@config = config @config = config
@options = options @options = options
end end
@ -385,7 +385,11 @@ module Puma
# Load the named plugin for use by this configuration # Load the named plugin for use by this configuration
# #
def plugin(name) def plugin(name)
@config.load_plugin name plugin = @config.load_plugin name
if plugin.respond_to? :config
plugin.config self
end
end end
end end
end end

View file

@ -26,5 +26,10 @@ module Puma
def in_background(&blk) def in_background(&blk)
Thread.new(&blk) Thread.new(&blk)
end end
def workers_supported?
return false if Puma.jruby? || Puma.windows?
true
end
end end
end end

View file

@ -1,3 +1,5 @@
require 'puma/plugin'
module Puma module Puma
class UnknownPlugin < RuntimeError; end class UnknownPlugin < RuntimeError; end