Sha256: 35e3f615f13619ef5c0893d258a29808109d5a4505785e9066e125248f28c137

Contents?: true

Size: 763 Bytes

Versions: 1

Compression:

Stored size: 763 Bytes

Contents

require "unicorn"

module Unicorn
  module Rails
    require "unicorn/rails/version"
  end
end

module Rack
  module Handler
    class Unicorn
      class << self
        def run(app, options = {})
          unicorn_options = {}
          unicorn_options[:listeners] = ["#{options[:Host]}:#{options[:Port]}"]
          unicorn_options[:worker_processes] = (ENV["UNICORN_WORKERS"] || "1").to_i
          unicorn_options[:timeout] = 31 * 24 * 60 * 60

          ::Unicorn::Launcher.daemonize!(unicorn_options) if options[:daemonize]
          ::Unicorn::HttpServer.new(app, unicorn_options).start.join
        end
      end
    end

    register "unicorn", "Rack::Handler::Unicorn"

    def self.default(options = {})
      Rack::Handler::Unicorn
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
unicorn-rails-1.0.1 lib/unicorn/rails.rb