Allow turning off Home::Endpoint
Home::Endpoint by default redirects GET / request to /docs. This may be desireable when Travis::Api::App is the only app running, but if it's running in front of other app, you may want to keep root for other things.
This commit is contained in:
parent
674ed5c34c
commit
5714fcf36d
|
@ -48,13 +48,15 @@ class Travis::Api::App
|
||||||
|
|
||||||
attr_accessor :app
|
attr_accessor :app
|
||||||
|
|
||||||
def initialize
|
def initialize(options = {})
|
||||||
Travis::Api::App.setup
|
Travis::Api::App.setup
|
||||||
@app = Rack::Builder.app do
|
@app = Rack::Builder.app do
|
||||||
use Rack::Protection::PathTraversal
|
use Rack::Protection::PathTraversal
|
||||||
use Rack::SSL if Endpoint.production?
|
use Rack::SSL if Endpoint.production?
|
||||||
Middleware.subclasses.each { |m| use(m) }
|
Middleware.subclasses.each { |m| use(m) }
|
||||||
Endpoint.subclasses.each { |e| map(e.prefix) { run(e) } }
|
endpoints = Endpoint.subclasses
|
||||||
|
endpoints -= [Endpoint::Home] if options[:disable_root_endpoint]
|
||||||
|
endpoints.each { |e| map(e.prefix) { run(e) } }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user