Class: Gitlab::Middleware::ReadOnly

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/middleware/read_only.rb,
lib/gitlab/middleware/read_only/controller.rb

Defined Under Namespace

Classes: Controller

Constant Summary collapse

API_VERSIONS =
(3..4).freeze

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ ReadOnly

Returns a new instance of ReadOnly.


13
14
15
# File 'lib/gitlab/middleware/read_only.rb', line 13

def initialize(app)
  @app = app
end

Class Method Details

.internal_routesObject


8
9
10
11
# File 'lib/gitlab/middleware/read_only.rb', line 8

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

Instance Method Details

#call(env) ⇒ Object


17
18
19
# File 'lib/gitlab/middleware/read_only.rb', line 17

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