Class: Falcon::Command::Virtual
- Inherits:
-
Samovar::Command
- Object
- Samovar::Command
- Falcon::Command::Virtual
- Includes:
- Paths
- Defined in:
- lib/falcon/command/virtual.rb
Overview
Implements the ‘falcon virtual` command. Designed for deployment.
Manages a Falcon::Controller::Virtual instance which is responsible for running the Proxy and Redirect instances.
Instance Attribute Summary collapse
-
#paths ⇒ Object
readonly
One or more paths to the configuration files.
Instance Method Summary collapse
-
#bind_insecure ⇒ Object
The URI to bind the ‘HTTP` -> `HTTPS` redirector.
-
#bind_secure ⇒ Object
The URI to bind the ‘HTTPS` -> `falcon host` proxy.
-
#call ⇒ Object
Prepare the environment and run the controller.
-
#controller ⇒ Object
Prepare a new controller for the command.
-
#host_endpoint(hostname, **options) ⇒ Object
An endpoint suitable for connecting to the specified hostname.
-
#insecure_endpoint(**options) ⇒ Object
The insecure endpoint for connecting to the Redirect instance.
-
#secure_endpoint(**options) ⇒ Object
The secure endpoint for connecting to the Proxy instance.
-
#timeout ⇒ Object
The connection timeout to use for incoming connections.
Methods included from Paths
#configuration, #resolved_paths
Instance Attribute Details
#paths ⇒ Object (readonly)
One or more paths to the configuration files.
31 |
# File 'lib/falcon/command/virtual.rb', line 31 many :paths |
Instance Method Details
#bind_insecure ⇒ Object
The URI to bind the ‘HTTP` -> `HTTPS` redirector.
46 47 48 |
# File 'lib/falcon/command/virtual.rb', line 46 def bind_insecure @options[:bind_insecure] end |
#bind_secure ⇒ Object
The URI to bind the ‘HTTPS` -> `falcon host` proxy.
41 42 43 |
# File 'lib/falcon/command/virtual.rb', line 41 def bind_secure @options[:bind_secure] end |
#call ⇒ Object
Prepare the environment and run the controller.
56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/falcon/command/virtual.rb', line 56 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 ⇒ Object
Prepare a new controller for the command.
36 37 38 |
# File 'lib/falcon/command/virtual.rb', line 36 def controller Controller::Virtual.new(self) end |
#host_endpoint(hostname, **options) ⇒ Object
An endpoint suitable for connecting to the specified hostname.
79 80 81 82 83 84 85 86 |
# File 'lib/falcon/command/virtual.rb', line 79 def host_endpoint(hostname, **) endpoint = secure_endpoint(**) url = URI.parse(@options[:bind_secure]) url.hostname = hostname return Async::HTTP::Endpoint.new(url, hostname: endpoint.hostname) end |
#insecure_endpoint(**options) ⇒ Object
The insecure endpoint for connecting to the Redirect instance.
69 70 71 |
# File 'lib/falcon/command/virtual.rb', line 69 def insecure_endpoint(**) Async::HTTP::Endpoint.parse(@options[:bind_insecure], **) end |
#secure_endpoint(**options) ⇒ Object
The secure endpoint for connecting to the Proxy instance.
74 75 76 |
# File 'lib/falcon/command/virtual.rb', line 74 def secure_endpoint(**) Async::HTTP::Endpoint.parse(@options[:bind_secure], **) end |
#timeout ⇒ Object
The connection timeout to use for incoming connections.
51 52 53 |
# File 'lib/falcon/command/virtual.rb', line 51 def timeout @options[:timeout] end |