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
33
# 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.



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

def app
  @app
end

#endpointObject

Returns the value of attribute endpoint.



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

def endpoint
  @endpoint
end

#ssl_certificateObject

Returns the value of attribute ssl_certificate.



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

def ssl_certificate
  @ssl_certificate
end

#ssl_contextObject

Returns the value of attribute ssl_context.



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

def ssl_context
  @ssl_context
end

#ssl_keyObject

Returns the value of attribute ssl_key.



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

def ssl_key
  @ssl_key
end

Instance Method Details

#freezeObject



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

def freeze
	return if frozen?
	
	ssl_context
	
	super
end

#ssl_certificate_path=(path) ⇒ Object



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

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

#ssl_key_path=(path) ⇒ Object



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

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

#startObject



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

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