Sha256: 81c1103dd70f644ba37bc87ebf582dc5c277be05bd09aa4ac15e16a127baf44b

Contents?: true

Size: 745 Bytes

Versions: 1

Compression:

Stored size: 745 Bytes

Contents

require 'restpack-core-client'

module RestPack
  module Web
    class App
      def initialize(app, settings)
        p "RestPack::Web::App.initialize"
        @app = app
        @settings = settings
        
        @core_cache = RestPack::Core::Client::Cache.create(@settings[:core_domain], @settings[:password])
      end

      def call(env)      
        env["restpack"] ||= {}
        host = env["SERVER_NAME"]
      
        env["restpack"][:host] = host
        begin #TODO: GJ: cache should handle errors gracefully
          env["restpack"][:channel] = @core_cache.get_channel(host)
        rescue Exception => e  
          p e.message  
          p e.backtrace.inspect
        end

        @app.call(env)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
restpack-web-0.1.0 lib/restpack-web/app.rb