class Virtual
Implements the falcon virtual
command. Designed for deployment.
Manages a Controller::Virtual
instance which is responsible for running the class Falcon::Command::Proxy
and class Falcon::Command::Redirect
instances.
Nested
Definitions
many :paths
One or more paths to the configuration files.
Signature
-
attribute
Array(String)
def call
Prepare the environment and run the controller.
Implementation
def call
Console.logger.info(self) do |buffer|
buffer.puts "Falcon Virtual v#{VERSION} taking flight!"
buffer.puts "- Running on #{RUBY_DESCRIPTION}"
buffer.puts "- To terminate: Ctrl-C or kill #{Process.pid}"
buffer.puts "- To reload all sites: kill -HUP #{Process.pid}"
end
Async::Service::Controller.run(self.configuration)
end
def insecure_endpoint(**options)
The insecure endpoint for connecting to the class Falcon::Command::Redirect
instance.
Implementation
def insecure_endpoint(**options)
Async::HTTP::Endpoint.parse(@options[:bind_insecure], **options)
end
def secure_endpoint(**options)
The secure endpoint for connecting to the class Falcon::Command::Proxy
instance.
Implementation
def secure_endpoint(**options)
Async::HTTP::Endpoint.parse(@options[:bind_secure], **options)
end
def host_endpoint(hostname, path: "/", **options)
An endpoint suitable for connecting to the specified hostname.
Implementation
def host_endpoint(hostname, path: "/", **options)
endpoint = secure_endpoint(**options)
url = URI.parse(@options[:bind_secure])
url.hostname = hostname
url.path = path
return Async::HTTP::Endpoint.new(url, hostname: endpoint.hostname)
end