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