Class: Falcon::Command::Proxy

Inherits:
Samovar::Command
  • Object
show all
Includes:
Paths
Defined in:
lib/falcon/command/proxy.rb

Overview

Implements the ‘falcon proxy` command.

Manages a Falcon::Controller::Proxy instance which is responsible for proxing incoming requests.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Paths

#configuration, #resolved_paths

Instance Attribute Details

#pathsObject (readonly)

One or more paths to the configuration files.



30
# File 'lib/falcon/command/proxy.rb', line 30

many :paths

Instance Method Details

#callObject

Prepare the environment and run the controller.



51
52
53
54
55
56
57
58
59
60
# File 'lib/falcon/command/proxy.rb', line 51

def call
	Console.logger.info(self) do |buffer|
		buffer.puts "Falcon Proxy v#{VERSION} taking flight!"
		buffer.puts "- Binding to: #{@options[:bind]}"
		buffer.puts "- To terminate: Ctrl-C or kill #{Process.pid}"
		buffer.puts "- To reload: kill -HUP #{Process.pid}"
	end
	
	self.controller.run
end

#container_classObject

The container class to use.



40
41
42
# File 'lib/falcon/command/proxy.rb', line 40

def container_class
	Async::Container.best_container_class
end

#container_optionsObject

Options for the container. See Falcon::Controller::Serve#setup.



46
47
48
# File 'lib/falcon/command/proxy.rb', line 46

def container_options
	{}
end

#controllerObject

Prepare a new controller for the command.



35
36
37
# File 'lib/falcon/command/proxy.rb', line 35

def controller
	Controller::Proxy.new(self)
end

#endpoint(**options) ⇒ Object

The endpoint to bind to.



63
64
65
# File 'lib/falcon/command/proxy.rb', line 63

def endpoint(**options)
	Async::HTTP::Endpoint.parse(@options[:bind], timeout: @options[:timeout], **options)
end