Sha256: a5852d6d3b3dc9e60921556c4167cc19b0926398afa7c8201b1acdbc6bddfcd1

Contents?: true

Size: 717 Bytes

Versions: 1

Compression:

Stored size: 717 Bytes

Contents

# encoding: utf-8
require 'reel'
require 'reel/rack'

module Virginia
  class Service
    def self.start
      config = Adhearsion.config.virginia

      # Rack-compatible options
      app, options = ::Rack::Builder.parse_file File.join(Adhearsion.root, config[:rackup])
      options = {
        Host: config[:host],
        Port: config[:port]
      }.merge(options)

      Virginia.logger.singleton_class.redefine_method(:write) { |msg| debug msg.chomp }

      app = Rack::CommonLogger.new(app, Virginia.logger)
      supervisor = ::Reel::Rack::Server.supervise_as(:reel_rack_server, app, options)

      Adhearsion::Events.register_callback :shutdown do
        supervisor.terminate
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
virginia-0.5.1 lib/virginia/service.rb