lib/envoy/client/command.rb in envoy-proxy-0.2.0 vs lib/envoy/client/command.rb in envoy-proxy-0.2.2
- old
+ new
@@ -39,9 +39,17 @@
options = parse_options
unless EM.reactor_running?
EM.run do
+ Signal.trap("INT") do
+ $exiting = true
+ EventMachine.stop
+ end
+ Signal.trap("TERM") do
+ $exiting = true
+ EventMachine.stop
+ end
load_config.each do |config|
config = config.merge(options)
config["local_port"] ||= config["command"] ? rand(16383) + 49152 : 80
config["hosts"] ||= [config.delete("host")] if config["host"]
config = config.each_with_object({}) do |(k, v), h|