Sha256: 69dcefc946a9e07a1e207008552ec456e4da3f2528561bb16322313a7e1e5214
Contents?: true
Size: 1.34 KB
Versions: 1
Compression:
Stored size: 1.34 KB
Contents
require 'restpack-core-client' module RestPack module Web class App def initialize(app, options = {}) p "RestPack::Web::App.initialize" @app = app options[:core_domain] ||= ENV['RESTPACK_CORE_SERVICE'] options[:access_key] ||= ENV['RESTPACK_ACCESS_KEY'] @core_cache = RestPack::Core::Client::Cache.create(options[:core_domain], options[:access_key]) end def call(env) begin #TODO: GJ: cache should handle errors gracefully env[:restpack] ||= {} host = env["SERVER_NAME"] p "RestPack App for #{host}" p "Session: #{env['rack.session']}" p "Session: #{env['rack.session'].inspect}" p "userid: #{env['rack.session'][:user_id]}" request = Rack::Request.new(env) p "request session: #{request.session.inspect}" env[:restpack][:host] = host channel = @core_cache.get_channel(host) domain = channel.get_domain_by_host(host) env[:restpack][:channel] = channel env[:restpack][:application] = domain.application env[:restpack][:domain] = domain 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.12 | lib/restpack-web/app.rb |