class Falcon::Controller::Redirect

A controller for redirecting requests.

Public Class Methods

new(command, **options) click to toggle source

Initialize the redirect controller. @parameter command [Command::Redirect] The user-specified command-line options.

Calls superclass method
# File lib/falcon/controller/redirect.rb, line 35
def initialize(command, **options)
        super(command, **options)
        
        @hosts = {}
end

Public Instance Methods

endpoint() click to toggle source

The endpoint the server will bind to.

# File lib/falcon/controller/redirect.rb, line 52
def endpoint
        @command.endpoint.with(
                reuse_address: true,
        )
end
load_app() click to toggle source

Load the {Middleware::Redirect} application with the specified hosts.

# File lib/falcon/controller/redirect.rb, line 42
def load_app
        return Middleware::Redirect.new(Middleware::NotFound, @hosts, @command.redirect_endpoint)
end
name() click to toggle source

The name of the controller which is used for the process title.

# File lib/falcon/controller/redirect.rb, line 47
def name
        "Falcon Redirect Server"
end
start() click to toggle source

Builds a map of host redirections.

Calls superclass method
# 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.authority] = service
                end
        end
        
        super
end