mirror of
https://gitlab.com/gitlab-org/gitlab-foss.git
synced 2025-08-06 10:19:48 +00:00
20 lines
452 B
Ruby
20 lines
452 B
Ruby
# frozen_string_literal: true
|
|
|
|
module Gitlab
|
|
module Middleware
|
|
class IpAddress
|
|
def initialize(app)
|
|
@app = app
|
|
end
|
|
|
|
def call(env)
|
|
return @app.call(env) if %r{^/api/v\d+/internal/}.match?(env['PATH_INFO'])
|
|
|
|
::Gitlab::IpAddressState.with(env['action_dispatch.remote_ip'].to_s) do # rubocop: disable CodeReuse/ActiveRecord -- not ActiveRecord
|
|
@app.call(env)
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|