class Falcon::Command::Virtual
Manages a {Controller::Virtual} instance which is responsible for running the {Proxy} and {Redirect} instances.
Implements the ‘falcon virtual` command. Designed for deployment.
def call
def call Console.logger.info(self) do |buffer| buffer.puts "Falcon Virtual v#{VERSION} taking flight!" 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 configuration
def configuration Async::Service::Configuration.new.tap do |configuration| configuration.add(self.environment) end end
def environment
def environment Async::Service::Environment.new(Falcon::Environment::Virtual).with( verbose: self.parent&.verbose?, configuration_paths: self.paths, bind_insecure: @options[:bind_insecure], bind_secure: @options[:bind_secure], timeout: @options[:timeout], ) end
def host_endpoint(hostname, path: "/", **options)
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
def insecure_endpoint(**options)
def insecure_endpoint(**options) Async::HTTP::Endpoint.parse(@options[:bind_insecure], **options) end
def secure_endpoint(**options)
def secure_endpoint(**options) Async::HTTP::Endpoint.parse(@options[:bind_secure], **options) end