10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/rack/handler/unicorn.rb', line 10
def run app, **options
unicorn_options = {
listeners: [options[:Host], options[:Port]].join(':'),
worker_processes: 2
}
if ::File.exist?(UNICORN_CONFIG_PATH)
unicorn_options[:config_file] = UNICORN_CONFIG_PATH
end
if unicorn_options[:config_file]
if ::File.read(unicorn_options[:config_file]) =~ /^(\s+)listen\s/
unicorn_options.delete :listeners
end
end
::Unicorn::HttpServer.new(app, unicorn_options).start.join
end
|