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



52
53
54
# File 'lib/falcon/command/virtual.rb', line 52

def bind_insecure
  @options[:bind_insecure]
end

#bind_secureObject



48
49
50
# File 'lib/falcon/command/virtual.rb', line 48

def bind_secure
  @options[:bind_secure]
end

#callObject



60
61
62
63
64
65
66
67
68
# File 'lib/falcon/command/virtual.rb', line 60

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



44
45
46
# File 'lib/falcon/command/virtual.rb', line 44

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

#host_endpoint(hostname, **options) ⇒ Object

An endpoint suitable for connecting to the specified hostname.



79
80
81
82
83
84
85
86
# File 'lib/falcon/command/virtual.rb', line 79

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



70
71
72
# File 'lib/falcon/command/virtual.rb', line 70

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

#secure_endpoint(**options) ⇒ Object



74
75
76
# File 'lib/falcon/command/virtual.rb', line 74

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

#timeoutObject



56
57
58
# File 'lib/falcon/command/virtual.rb', line 56

def timeout
  @options[:timeout]
end