Class: Kumonos::Envoy::DiscoverService
- Inherits:
-
Struct
- Object
- Struct
- Kumonos::Envoy::DiscoverService
- Defined in:
- lib/kumonos/envoy.rb
Instance Attribute Summary collapse
-
#cluster ⇒ Object
Returns the value of attribute cluster.
-
#refresh_delay_ms ⇒ Object
Returns the value of attribute refresh_delay_ms.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#cluster ⇒ Object
Returns the value of attribute cluster
166 167 168 |
# File 'lib/kumonos/envoy.rb', line 166 def cluster @cluster end |
#refresh_delay_ms ⇒ Object
Returns the value of attribute refresh_delay_ms
166 167 168 |
# File 'lib/kumonos/envoy.rb', line 166 def refresh_delay_ms @refresh_delay_ms end |
Class Method Details
.build(h) ⇒ Object
168 169 170 171 172 173 174 175 176 177 178 179 180 |
# File 'lib/kumonos/envoy.rb', line 168 def build(h) lb = h.fetch('lb') host, port = lb.split(':') cluster = Cluster.new( lb.split(':').first, 'STRICT_DNS', h.fetch('tls'), h.fetch('connect_timeout_ms'), 'ROUND_ROBIN', [{ 'socket_address' => { 'address' => host, 'port_value' => Integer(port) } }] ) new(h.fetch('refresh_delay_ms'), cluster) end |
Instance Method Details
#to_h ⇒ Object
183 184 185 186 187 |
# File 'lib/kumonos/envoy.rb', line 183 def to_h h = super h[:cluster] = cluster.to_h h end |