gitlab-org--gitlab-foss/lib/gitlab/request_context.rb

24 lines
376 B
Ruby
Raw Normal View History

# frozen_string_literal: true
module Gitlab
class RequestContext
class << self
def client_ip
Gitlab::SafeRequestStore[:client_ip]
end
end
def initialize(app)
@app = app
end
def call(env)
req = ActionDispatch::Request.new(env)
Gitlab::SafeRequestStore[:client_ip] = req.ip
@app.call(env)
end
end
2017-02-16 05:21:30 -05:00
end