Class: Falcon::Command::Virtual

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

Instance Method Summary collapse

Methods included from Paths

#configuration, #resolved_paths

Instance Method Details

#bind_insecureObject



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

def bind_insecure
	@options[:bind_insecure]
end

#bind_secureObject



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

def bind_secure
	@options[:bind_secure]
end

#callObject



54
55
56
57
58
59
60
61
62
# File 'lib/falcon/command/virtual.rb', line 54

def call
	Async.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
	
	self.controller.run
end

#controllerObject



42
43
44
# File 'lib/falcon/command/virtual.rb', line 42

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

#host_endpoint(hostname, **options) ⇒ Object

An endpoint suitable for connecting to the specified hostname.



73
74
75
76
77
78
79
80
# File 'lib/falcon/command/virtual.rb', line 73

def host_endpoint(hostname, **options)
	endpoint = secure_endpoint(**options)
	
	url = URI.parse(@options[:bind_secure])
	url.hostname = hostname
	
	return Async::HTTP::Endpoint.new(url, hostname: endpoint.hostname)
end

#insecure_endpoint(**options) ⇒ Object



64
65
66
# File 'lib/falcon/command/virtual.rb', line 64

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

#secure_endpoint(**options) ⇒ Object



68
69
70
# File 'lib/falcon/command/virtual.rb', line 68

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