Class: Falcon::Command::Redirect

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

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.



45
# File 'lib/falcon/command/redirect.rb', line 45

many :paths

Instance Method Details

#callObject

Prepare the environment and run the controller.



66
67
68
69
70
71
72
73
74
75
# File 'lib/falcon/command/redirect.rb', line 66

def call
	Console.logger.info(self) do |buffer|
		buffer.puts "Falcon Redirect 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.



55
56
57
# File 'lib/falcon/command/redirect.rb', line 55

def container_class
	Async::Container.best_container_class
end

#container_optionsObject

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



61
62
63
# File 'lib/falcon/command/redirect.rb', line 61

def container_options
	{}
end

#controllerObject

Prepare a new controller for the command.



50
51
52
# File 'lib/falcon/command/redirect.rb', line 50

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

#endpoint(**options) ⇒ Object

The endpoint to bind to.



78
79
80
# File 'lib/falcon/command/redirect.rb', line 78

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

#redirect_endpoint(**options) ⇒ Object

The template endpoint to redirect to.



83
84
85
# File 'lib/falcon/command/redirect.rb', line 83

def redirect_endpoint(**options)
	Async::HTTP::Endpoint.parse(@options[:redirect], **options)
end