Class: ReverseProxy::Server::Puma

Inherits:
Generic
  • Object
show all
Defined in:
lib/reverse_proxy/server/puma.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Generic

#name

Methods included from Logger

#log

Constructor Details

#initialize(proxy) ⇒ Puma

Returns a new instance of Puma.



5
6
7
8
9
10
# File 'lib/reverse_proxy/server/puma.rb', line 5

def initialize proxy
  Bind::Formatter.add :puma, Proc.new {|data| "#{data.scheme}://#{data.data}"}
  @server       = ::Puma
  @proxy        = proxy
  @default_bind = 'tcp://0.0.0.0:9292'
end

Instance Attribute Details

#default_bindObject (readonly)

Returns the value of attribute default_bind.



4
5
6
# File 'lib/reverse_proxy/server/puma.rb', line 4

def default_bind
  @default_bind
end

#proxyObject (readonly)

Returns the value of attribute proxy.



4
5
6
# File 'lib/reverse_proxy/server/puma.rb', line 4

def proxy
  @proxy
end

#serverObject (readonly)

Returns the value of attribute server.



4
5
6
# File 'lib/reverse_proxy/server/puma.rb', line 4

def server
  @server
end

Instance Method Details

#bindsObject



17
18
19
# File 'lib/reverse_proxy/server/puma.rb', line 17

def binds
  ([] + config.options[:binds]).compact
end

#binds=(binds) ⇒ Object



20
21
22
23
# File 'lib/reverse_proxy/server/puma.rb', line 20

def binds= binds
  config.options[:binds] = binds
  log "#{name} listens at #{binds.empty? ? "default" : binds.join(", ")}"
end

#configObject



11
12
13
# File 'lib/reverse_proxy/server/puma.rb', line 11

def config
  @server.cli_config
end

#socketObject



14
15
16
# File 'lib/reverse_proxy/server/puma.rb', line 14

def socket
  @socket ||= Bind.new proxy.config.dir.join('puma.sock').to_s
end