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:
parent
663666c5b7
commit
541393ebf9
4 changed files with 14 additions and 3 deletions
|
@ -204,7 +204,7 @@ module Puma
|
|||
o.banner = "puma <options> <rackup file>"
|
||||
|
||||
o.on_tail "-h", "--help", "Show help" do
|
||||
log o
|
||||
$stdout.puts o
|
||||
exit 0
|
||||
end
|
||||
end
|
||||
|
|
|
@ -12,7 +12,7 @@ module Puma
|
|||
options
|
||||
end
|
||||
|
||||
def initialize(config, options)
|
||||
def initialize(options, config)
|
||||
@config = config
|
||||
@options = options
|
||||
end
|
||||
|
@ -385,7 +385,11 @@ module Puma
|
|||
# Load the named plugin for use by this configuration
|
||||
#
|
||||
def plugin(name)
|
||||
@config.load_plugin name
|
||||
plugin = @config.load_plugin name
|
||||
|
||||
if plugin.respond_to? :config
|
||||
plugin.config self
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -26,5 +26,10 @@ module Puma
|
|||
def in_background(&blk)
|
||||
Thread.new(&blk)
|
||||
end
|
||||
|
||||
def workers_supported?
|
||||
return false if Puma.jruby? || Puma.windows?
|
||||
true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
require 'puma/plugin'
|
||||
|
||||
module Puma
|
||||
class UnknownPlugin < RuntimeError; end
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue