Class: Falcon::Controller::Redirect
- Defined in:
- lib/falcon/controller/redirect.rb
Overview
A controller for redirecting requests.
Instance Method Summary collapse
-
#endpoint ⇒ Object
The endpoint the server will bind to.
-
#initialize(command, **options) ⇒ Redirect
constructor
Initialize the redirect controller.
-
#load_app ⇒ Object
Load the Middleware::Redirect application with the specified hosts.
-
#name ⇒ Object
The name of the controller which is used for the process title.
-
#start ⇒ Object
Builds a map of host redirections.
Methods inherited from Serve
#create_container, #setup, #stop
Constructor Details
#initialize(command, **options) ⇒ Redirect
Initialize the redirect controller.
35 36 37 38 39 |
# File 'lib/falcon/controller/redirect.rb', line 35 def initialize(command, **) super(command, **) @hosts = {} end |
Instance Method Details
#endpoint ⇒ Object
The endpoint the server will bind to.
52 53 54 55 56 |
# File 'lib/falcon/controller/redirect.rb', line 52 def endpoint @command.endpoint.with( reuse_address: true, ) end |
#load_app ⇒ Object
Load the Middleware::Redirect application with the specified hosts.
42 43 44 |
# File 'lib/falcon/controller/redirect.rb', line 42 def load_app return Middleware::Redirect.new(Middleware::NotFound, @hosts, @command.redirect_endpoint) end |
#name ⇒ Object
The name of the controller which is used for the process title.
47 48 49 |
# File 'lib/falcon/controller/redirect.rb', line 47 def name "Falcon Redirect Server" end |
#start ⇒ Object
Builds a map of host redirections.
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/falcon/controller/redirect.rb', line 59 def start configuration = @command.configuration services = Services.new(configuration) @hosts = {} services.each do |service| if service.is_a?(Service::Proxy) @hosts[service.] = service end end super end |