Module: ReverseProxy::Patch::Puma::DSL

Defined in:
lib/reverse_proxy/patch/puma.rb

Instance Method Summary collapse

Instance Method Details

#reverse_proxy(proxy) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/reverse_proxy/patch/puma.rb', line 5

def reverse_proxy proxy
  @proxy_klass ||= ReverseProxy::Proxy.const_get(proxy)
  @proxy       ||= @proxy_klass.new server: :Puma

  @proxy.hijack do |secondary_bind|
    bind secondary_bind.unix.to_puma
  end

  after_worker_boot do
    @options[:logger].register(:on_booted){@proxy.on_booted}
  end
  
  @proxy.application_config = self
  %i{
    after_worker_boot
    on_restart
    on_worker_boot
    on_worker_shutdown
  }.each do |event|
    self.send(event){ @proxy.send(event)}
  end
end