class Falcon::Command::Virtual
Implements the `falcon virtual` command. Designed for deployment.
Manages a {Controller::Virtual} instance which is responsible for running the {Proxy} and {Redirect} instances.
Public Instance Methods
bind_insecure()
click to toggle source
The URI to bind the `HTTP` -> `HTTPS` redirector.
# File lib/falcon/command/virtual.rb, line 63 def bind_insecure @options[:bind_insecure] end
bind_secure()
click to toggle source
The URI to bind the `HTTPS` -> `falcon host` proxy.
# File lib/falcon/command/virtual.rb, line 58 def bind_secure @options[:bind_secure] end
call()
click to toggle source
Prepare the environment and run the controller.
# File lib/falcon/command/virtual.rb, line 73 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 ENV['CONSOLE_LEVEL'] = 'debug' self.controller.run end
controller()
click to toggle source
Prepare a new controller for the command.
# File lib/falcon/command/virtual.rb, line 53 def controller Controller::Virtual.new(self) end
host_endpoint(hostname, **options)
click to toggle source
An endpoint suitable for connecting to the specified hostname.
# File lib/falcon/command/virtual.rb, line 96 def host_endpoint(hostname, **options) endpoint = secure_endpoint(**options) url = URI.parse(@options[:bind_secure]) url.hostname = hostname return Async::HTTP::Endpoint.new(url, hostname: endpoint.hostname) end
insecure_endpoint(**options)
click to toggle source
The insecure endpoint for connecting to the {Redirect} instance.
# File lib/falcon/command/virtual.rb, line 86 def insecure_endpoint(**options) Async::HTTP::Endpoint.parse(@options[:bind_insecure], **options) end
secure_endpoint(**options)
click to toggle source
The secure endpoint for connecting to the {Proxy} instance.
# File lib/falcon/command/virtual.rb, line 91 def secure_endpoint(**options) Async::HTTP::Endpoint.parse(@options[:bind_secure], **options) end
timeout()
click to toggle source
The connection timeout to use for incoming connections.
# File lib/falcon/command/virtual.rb, line 68 def timeout @options[:timeout] end