Sha256: 6bbfe9fc58fa2566bb0e56b6eb9904b72f7e2c571073b6a8ab1f22a3f1040fc8
Contents?: true
Size: 527 Bytes
Versions: 6
Compression:
Stored size: 527 Bytes
Contents
# frozen_string_literal: true class Saasable::Middleware def initialize(app) @app = app end def call(env) return @app.call(env) if env['PATH_INFO'].start_with?('/assets') saas = saas_for_host(env['SERVER_NAME']) saas&.activate! @app.call(env).tap { saas&.deactivate! } end private def saas_for_host(hostname) Saasable::Mongoid::SaasDocument.saas_document.find_by_host!(hostname) rescue Saasable::Errors::SaasNotFound nil # Saas not found is treated by the Rails Helper end end
Version data entries
6 entries across 6 versions & 1 rubygems