Class: Miron::Handler::Unicorn::Proxy

Inherits:
Object
  • Object
show all
Defined in:
lib/miron/handlers/unicorn.rb

Instance Method Summary collapse

Constructor Details

#initialize(mironfile, options) ⇒ Proxy


37
38
39
40
41
# File 'lib/miron/handlers/unicorn.rb', line 37

def initialize(mironfile, options)
  @mironfile = mironfile
  @options = options
  listen(@options['host'], @options['port'].to_i)
end

Instance Method Details

#listen(address, port) ⇒ Object


43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/miron/handlers/unicorn.rb', line 43

def listen(address, port)
  puts 'Unicorn starting...'
  puts "* Environment: #{@options['environment']}"
  puts "* Listening on #{@options['host']}:#{@options['port']}"
  begin
    ::Miron::Handler::Unicorn.new(@mironfile, {
                                    listeners: ["#{address}:#{port}"],
                                    logger: Logger.new(nil)
                                  }).start.join
  rescue Interrupt
    puts '* Shutting down...'
  end
end