2018-11-17 00:37:17 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-09-19 07:44:58 +00:00
|
|
|
module Gitlab
|
|
|
|
module Middleware
|
|
|
|
class ReadOnly
|
2019-05-05 10:19:14 +00:00
|
|
|
API_VERSIONS = (3..4).freeze
|
2017-09-19 07:44:58 +00:00
|
|
|
|
2018-02-02 14:12:28 +00:00
|
|
|
def self.internal_routes
|
|
|
|
@internal_routes ||=
|
|
|
|
API_VERSIONS.map { |version| "api/v#{version}/internal" }
|
2017-09-19 07:44:58 +00:00
|
|
|
end
|
|
|
|
|
2018-02-02 14:12:28 +00:00
|
|
|
def initialize(app)
|
|
|
|
@app = app
|
|
|
|
end
|
2017-11-20 23:27:52 +00:00
|
|
|
|
2018-02-02 14:12:28 +00:00
|
|
|
def call(env)
|
2018-03-22 04:18:11 +00:00
|
|
|
::Gitlab::Middleware::ReadOnly::Controller.new(@app, env).call
|
2017-09-19 07:44:58 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|