Sha256: 27154c3161d40195583c160f67f0c0cc1ddb7d8a985a77b6e9574ce4d616fcd7

Contents?: true

Size: 614 Bytes

Versions: 39

Compression:

Stored size: 614 Bytes

Contents

module RackGraphql
  class HealthResponseBuilder
    def initialize(app_name:, env: {})
      @app_name = app_name
      @request = Rack::Request.new(env)
    end

    def build
      [200, headers, [body]]
    end

    private

    attr_reader :app_name, :request

    def headers
      { 'Content-Type' => 'application/json' }
    end

    def body
      Oj.dump(
        'status'     => 'ok',
        'request_ip' => request.ip,
        'app_name'   => app_name,
        'app_env'    => ENV['RACK_ENV'],
        'host'       => ENV['HOSTNAME'],
        'revision'   => ENV['REVISION']
      )
    end
  end
end

Version data entries

39 entries across 39 versions & 1 rubygems

Version Path
rack-graphql-3.6.0 lib/rack_graphql/health_response_builder.rb
rack-graphql-3.5.0 lib/rack_graphql/health_response_builder.rb
rack-graphql-3.3.0 lib/rack_graphql/health_response_builder.rb
rack-graphql-3.3.0.beta lib/rack_graphql/health_response_builder.rb
rack-graphql-3.2.0 lib/rack_graphql/health_response_builder.rb
rack-graphql-3.2.0.beta lib/rack_graphql/health_response_builder.rb
rack-graphql-3.1.3 lib/rack_graphql/health_response_builder.rb
rack-graphql-3.1.2 lib/rack_graphql/health_response_builder.rb
rack-graphql-3.1.1 lib/rack_graphql/health_response_builder.rb
rack-graphql-3.1.0 lib/rack_graphql/health_response_builder.rb
rack-graphql-3.0.1 lib/rack_graphql/health_response_builder.rb
rack-graphql-3.0.0 lib/rack_graphql/health_response_builder.rb
rack-graphql-2.11.0 lib/rack_graphql/health_response_builder.rb
rack-graphql-2.10.1 lib/rack_graphql/health_response_builder.rb
rack-graphql-2.10.0 lib/rack_graphql/health_response_builder.rb
rack-graphql-2.9.1 lib/rack_graphql/health_response_builder.rb
rack-graphql-2.9.0 lib/rack_graphql/health_response_builder.rb
rack-graphql-2.7.3 lib/rack_graphql/health_response_builder.rb
rack-graphql-2.7.2 lib/rack_graphql/health_response_builder.rb
rack-graphql-2.7.1 lib/rack_graphql/health_response_builder.rb