Sha256: ed9665b90c99f9a15f88dadf7993caf33c52c1054b975c36b66f2c0cb572e144

Contents?: true

Size: 596 Bytes

Versions: 4

Compression:

Stored size: 596 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
      MultiJson.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

4 entries across 4 versions & 1 rubygems

Version Path
rack-graphql-0.7.1 lib/rack_graphql/health_response_builder.rb
rack-graphql-0.7.0 lib/rack_graphql/health_response_builder.rb
rack-graphql-0.6.0 lib/rack_graphql/health_response_builder.rb
rack-graphql-0.5.2 lib/rack_graphql/health_response_builder.rb