Class: Synapse::Rails::ProviderProxy
- Inherits:
-
Object
- Object
- Synapse::Rails::ProviderProxy
- Defined in:
- lib/synapse/rails/provider_proxy.rb
Instance Attribute Summary collapse
-
#check ⇒ Object
Returns the value of attribute check.
-
#fall ⇒ Object
Returns the value of attribute fall.
-
#inter ⇒ Object
Returns the value of attribute inter.
-
#mode ⇒ Object
Returns the value of attribute mode.
-
#rise ⇒ Object
Returns the value of attribute rise.
-
#uri ⇒ Object
Returns the value of attribute uri.
Instance Method Summary collapse
- #haproxy ⇒ Object
-
#initialize(params = {}) ⇒ ProviderProxy
constructor
A new instance of ProviderProxy.
- #listen ⇒ Object
- #server_options ⇒ Object
Constructor Details
#initialize(params = {}) ⇒ ProviderProxy
Returns a new instance of ProviderProxy.
5 6 7 8 9 10 11 12 |
# File 'lib/synapse/rails/provider_proxy.rb', line 5 def initialize params={} @mode = ( params[:mode] || "tcp" ) @check = params[:check] == nil ? true : params[:check] @uri = params[:uri] @inter = ( params[:inter] || "2s" ) @rise = ( params[:rise] || 2 ) @fall = ( params[:fall] || 3 ) end |
Instance Attribute Details
#check ⇒ Object
Returns the value of attribute check.
4 5 6 |
# File 'lib/synapse/rails/provider_proxy.rb', line 4 def check @check end |
#fall ⇒ Object
Returns the value of attribute fall.
4 5 6 |
# File 'lib/synapse/rails/provider_proxy.rb', line 4 def fall @fall end |
#inter ⇒ Object
Returns the value of attribute inter.
4 5 6 |
# File 'lib/synapse/rails/provider_proxy.rb', line 4 def inter @inter end |
#mode ⇒ Object
Returns the value of attribute mode.
4 5 6 |
# File 'lib/synapse/rails/provider_proxy.rb', line 4 def mode @mode end |
#rise ⇒ Object
Returns the value of attribute rise.
4 5 6 |
# File 'lib/synapse/rails/provider_proxy.rb', line 4 def rise @rise end |
#uri ⇒ Object
Returns the value of attribute uri.
4 5 6 |
# File 'lib/synapse/rails/provider_proxy.rb', line 4 def uri @uri end |
Instance Method Details
#haproxy ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/synapse/rails/provider_proxy.rb', line 13 def haproxy { port: Freeport.port, listen: listen, server_options: }.with_indifferent_access end |
#listen ⇒ Object
24 25 26 27 28 29 |
# File 'lib/synapse/rails/provider_proxy.rb', line 24 def listen @listen = [] @listen << "mode #{mode}" @listen << "option httpchk #{uri}" if uri @listen end |
#server_options ⇒ Object
20 21 22 23 |
# File 'lib/synapse/rails/provider_proxy.rb', line 20 def return "check inter #{inter} rise #{rise} fall #{fall}" if check "" end |