Class: Kumonos::Envoy::Listener

Inherits:
Struct
  • Object
show all
Defined in:
lib/kumonos/envoy.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#access_log_pathObject

Returns the value of attribute access_log_path

Returns:

  • (Object)

    the current value of access_log_path



43
44
45
# File 'lib/kumonos/envoy.rb', line 43

def access_log_path
  @access_log_path
end

#addressObject

Returns the value of attribute address

Returns:

  • (Object)

    the current value of address



43
44
45
# File 'lib/kumonos/envoy.rb', line 43

def address
  @address
end

#dsObject

Returns the value of attribute ds

Returns:

  • (Object)

    the current value of ds



43
44
45
# File 'lib/kumonos/envoy.rb', line 43

def ds
  @ds
end

Class Method Details

.build(h, ds) ⇒ Object



45
46
47
# File 'lib/kumonos/envoy.rb', line 45

def build(h, ds)
  new(h.fetch('address'), h.fetch('access_log_path'), ds)
end

Instance Method Details

#to_hObject



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/kumonos/envoy.rb', line 50

def to_h
  h = super
  h.delete(:ds)
  h.delete(:access_log_path)
  h[:filters] = [
    {
      type: 'read',
      name: 'http_connection_manager',
      config: {
        codec_type: 'auto',
        stat_prefix: 'egress_http',
        access_log: [{ path: access_log_path }],
        rds: {
          cluster: ds.cluster.name,
          route_config_name: DEFAULT_ROUTE_NAME,
          refresh_delay_ms: ds.refresh_delay_ms
        },
        filters: [{ type: 'decoder', name: 'router', config: {} }]
      }
    }
  ]
  h
end