Module: ElasticGraph::HealthCheck::EnvoyExtension

Defined in:
lib/elastic_graph/health_check/envoy_extension.rb,
lib/elastic_graph/health_check/envoy_extension/graphql_http_endpoint_decorator.rb

Overview

An extension module that hooks into the HTTP endpoint to provide Envoy health checks.

Defined Under Namespace

Classes: GraphQLHTTPEndpointDecorator

Instance Method Summary collapse

Instance Method Details

#graphql_http_endpointObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/elastic_graph/health_check/envoy_extension.rb', line 17

def graphql_http_endpoint
  @graphql_http_endpoint ||=
    begin
      http_path_segment = config.extension_settings.dig("health_check", "http_path_segment")
      http_path_segment ||= 
        .graphql_extension_modules
        .find { |ext_mod| ext_mod.extension_class == EnvoyExtension }
        &.extension_config
        &.dig(:http_path_segment)

      if http_path_segment.nil?
        raise ElasticGraph::ConfigSettingNotSetError, "Health check `http_path_segment` is not configured. " \
          "Either set under `health_check` in YAML config or pass it along if you register the `EnvoyExtension` " \
          "via `register_graphql_extension`."
      end

      GraphQLHTTPEndpointDecorator.new(
        super,
        health_check_http_path_segment: http_path_segment,
        health_checker: HealthChecker.build_from(self),
        logger: logger
      )
    end
end