summaryrefslogtreecommitdiff
path: root/lib/gitlab/middleware/read_only.rb
blob: d9d5f90596f63de4f131ec02d0ece1d699ee1df1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
module Gitlab
  module Middleware
    class ReadOnly
      API_VERSIONS = (3..4)

      def self.internal_routes
        @internal_routes ||=
          API_VERSIONS.map { |version| "api/v#{version}/internal" }
      end

      def initialize(app)
        @app = app
      end

      def call(env)
        ReadOnly::Controller.new(@app, env).call
      end
    end
  end
end