Welcome to mirror list, hosted at ThFree Co, Russian Federation.

request_context.rb « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: f8f8ec789cea557f53a6bb07658ba67d334b959a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# 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 = Rack::Request.new(env)

      Gitlab::SafeRequestStore[:client_ip] = req.ip

      @app.call(env)
    end
  end
end