12
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/rack/handler/unicorn.rb', line 12
def run(app, options = {})
environment = ENV['RACK_ENV'] || 'development'
default_host = (environment == 'development') ? 'localhost' : '0.0.0.0'
options[:Host] ||= default_host
unicorn_options = {
listeners: [ '%s:%d' % [ options[:Host], options[:Port] ] ],
worker_processes: options[:worker_processes] || 1
}
::Unicorn::Launcher.daemonize!(unicorn_options) if options[:daemonize]
::Unicorn::HttpServer.new(app, unicorn_options).start.join
end
|