Class: Falcon::Host

Inherits:
Object
  • Object
show all
Defined in:
lib/falcon/hosts.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeHost

Returns a new instance of Host.



25
26
27
28
29
30
31
32
# File 'lib/falcon/hosts.rb', line 25

def initialize
	@app = nil
	@endpoint = nil
	@ssl_certificate = nil
	@ssl_key = nil
	
	@ssl_context = nil
end

Instance Attribute Details

#appObject

Returns the value of attribute app.



34
35
36
# File 'lib/falcon/hosts.rb', line 34

def app
  @app
end

#endpointObject

Returns the value of attribute endpoint.



36
37
38
# File 'lib/falcon/hosts.rb', line 36

def endpoint
  @endpoint
end

#ssl_certificateObject

Returns the value of attribute ssl_certificate.



38
39
40
# File 'lib/falcon/hosts.rb', line 38

def ssl_certificate
  @ssl_certificate
end

#ssl_contextObject

Returns the value of attribute ssl_context.



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

def ssl_context
  @ssl_context
end

#ssl_keyObject

Returns the value of attribute ssl_key.



39
40
41
# File 'lib/falcon/hosts.rb', line 39

def ssl_key
  @ssl_key
end

Instance Method Details

#freezeObject



42
43
44
45
46
47
48
# File 'lib/falcon/hosts.rb', line 42

def freeze
	return if frozen?
	
	ssl_context
	
	super
end

#ssl_certificate_path=(path) ⇒ Object



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

def ssl_certificate_path= path
	@ssl_certificate = OpenSSL::X509::Certificate.new(File.read(path))
end

#ssl_key_path=(path) ⇒ Object



54
55
56
# File 'lib/falcon/hosts.rb', line 54

def ssl_key_path= path
	@ssl_key = OpenSSL::PKey::RSA.new(File.read(path))
end

#startObject



71
72
73
74
75
76
77
78
79
# File 'lib/falcon/hosts.rb', line 71

def start
	if app = self.app
		Async::Container::Forked.new do
			server = Falcon::Server.new(app, self.server_endpoint)
			
			server.run
		end
	end
end