Class: Falcon::Command::Host

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

Overview

Implements the ‘falcon host` command. Designed for deployment.

Manages a Controller::Host instance which is responsible for running applications in a production environment.

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.



23
# File 'lib/falcon/command/host.rb', line 23

many :paths, "Service configuration paths.", default: ["falcon.rb"]

Instance Method Details

#callObject

Prepare the environment and run the controller.



33
34
35
36
37
38
39
40
41
42
# File 'lib/falcon/command/host.rb', line 33

def call
	Console.logger.info(self) do |buffer|
		buffer.puts "Falcon Host v#{VERSION} taking flight!"
		buffer.puts "- Configuration: #{@paths.join(', ')}"
		buffer.puts "- To terminate: Ctrl-C or kill #{Process.pid}"
		buffer.puts "- To reload: kill -HUP #{Process.pid}"
	end
	
	Async::Service::Controller.run(self.configuration, container_class: self.container_class)
end

#container_classObject

The container class to use.



28
29
30
# File 'lib/falcon/command/host.rb', line 28

def container_class
	Async::Container.best_container_class
end