Class: Falcon::Host

Inherits:
Service show all
Defined in:
lib/falcon/host.rb

Instance Method Summary collapse

Methods inherited from Service

#initialize

Constructor Details

This class inherits a constructor from Falcon::Service

Instance Method Details

#authorityObject



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

def authority
  @evaluator.authority
end

#bound_endpointObject



45
46
47
# File 'lib/falcon/host.rb', line 45

def bound_endpoint
  @evaluator.bound_endpoint
end

#endpointObject



33
34
35
# File 'lib/falcon/host.rb', line 33

def endpoint
  @evaluator.endpoint
end

#nameObject



25
26
27
# File 'lib/falcon/host.rb', line 25

def name
  "Falcon Host for #{self.authority}"
end

#rootObject



41
42
43
# File 'lib/falcon/host.rb', line 41

def root
  @evaluator.root
end

#run(container) ⇒ Object



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/falcon/host.rb', line 53

def run(container)
  if @environment.include?(:server)
    bound_endpoint = self.bound_endpoint
    
    container.run(name: self.name, restart: true) do |task, instance|
      Async.logger.info(self) {"Starting application server, binding to #{self.endpoint}..."}
      
      server = @evaluator.server
      
      server.run
      
      task.children.each(&:wait)
    end
    
    container.attach do
      bound_endpoint.close
    end
  end
end

#ssl_contextObject



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

def ssl_context
  @evaluator.ssl_context
end

#to_sObject



49
50
51
# File 'lib/falcon/host.rb', line 49

def to_s
  "\#<#{self.class} #{@evaluator.authority}>"
end