Sha256: a0e93132b9bcfabaa5a13abcda8806dbea2319b91038988c93bc40ae251f9221

Contents?: true

Size: 511 Bytes

Versions: 1

Compression:

Stored size: 511 Bytes

Contents

module Circuit
  module Rack
    # Finds the Circuit::Site for the request.  Returns a 404 if the site is not found.
    class MultiSite
      def initialize(app)
        @app = app
      end

      def call(env)
        request = ::Rack::Request.new(env)

        request.site = Circuit.site_store.get(request.host)
        unless request.site
          # TODO custom 404 page for site not found
          return [404, {}, ["Not Found"]]
        end

        @app.call(request.env)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
circuit-0.2.0 lib/circuit/rack/multi_site.rb