Sha256: a03b33e49902e5800eae6ae70c32b48adabe6f85d134a1e45de37d071fed16e2
Contents?: true
Size: 1 KB
Versions: 12
Compression:
Stored size: 1 KB
Contents
# connects_to database: module Gorynich module Head class RackMiddleware def initialize(app) @app = app end def call(env) @config ||= Gorynich.instance @config.actualize tenant, opts = Gorynich.switcher.analyze(env) Gorynich.with(tenant, **opts) do if Rails.logger.respond_to?(:tagged) Rails.logger.tagged("Tenant(#{tenant})") { @app.call(env) } else @app.call(env) end end rescue Gorynich::UriNotFound => e Rails.logger.error(e.inspect) [404, { 'Content-Type' => 'text/plain', 'charset' => 'UTF-8' }, [e.message]] rescue Gorynich::HostNotFound => e Rails.logger.error(e.inspect) [404, { 'Content-Type' => 'text/plain', 'charset' => 'UTF-8' }, [e.message]] rescue Gorynich::TenantNotFound => e Rails.logger.error(e.inspect) [404, { 'Content-Type' => 'text/plain', 'charset' => 'UTF-8' }, [e.message]] end end end end
Version data entries
12 entries across 12 versions & 1 rubygems