Class: Falcon::Command::Virtual
- Inherits:
-
Samovar::Command
- Object
- Samovar::Command
- Falcon::Command::Virtual
- Defined in:
- lib/falcon/command/virtual.rb
Overview
Instance Attribute Summary collapse
-
#paths ⇒ Object
readonly
One or more paths to the configuration files.
Instance Method Summary collapse
-
#call ⇒ Object
Prepare the environment and run the controller.
- #configuration ⇒ Object
- #environment ⇒ Object
-
#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.
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
#call ⇒ Object
Prepare the environment and run the controller.
50 51 52 53 54 55 56 57 58 |
# File 'lib/falcon/command/virtual.rb', line 50 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 |
#configuration ⇒ Object
43 44 45 46 47 |
# File 'lib/falcon/command/virtual.rb', line 43 def configuration Async::Service::Configuration.new.tap do |configuration| configuration.add(self.environment) end end |
#environment ⇒ Object
33 34 35 36 37 38 39 40 41 |
# File 'lib/falcon/command/virtual.rb', line 33 def environment Async::Service::Environment.new(Falcon::Service::Virtual::Environment).with( verbose: self.parent&.verbose?, configuration_paths: self.paths, bind_insecure: @options[:bind_insecure], bind_secure: @options[:bind_secure], timeout: @options[:timeout], ) end |
#host_endpoint(hostname, **options) ⇒ Object
An endpoint suitable for connecting to the specified hostname.
71 72 73 74 75 76 77 78 |
# File 'lib/falcon/command/virtual.rb', line 71 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.
61 62 63 |
# File 'lib/falcon/command/virtual.rb', line 61 def insecure_endpoint(**) Async::HTTP::Endpoint.parse(@options[:bind_insecure], **) end |
#secure_endpoint(**options) ⇒ Object
The secure endpoint for connecting to the Proxy instance.
66 67 68 |
# File 'lib/falcon/command/virtual.rb', line 66 def secure_endpoint(**) Async::HTTP::Endpoint.parse(@options[:bind_secure], **) end |