Sha256: 982e8d573f8c0ec516a443b45d5a6508121c12a8b00a9b6648cdbe20605f1ae1
Contents?: true
Size: 995 Bytes
Versions: 6
Compression:
Stored size: 995 Bytes
Contents
# connects_to database: module Gorynich module Head class RackMiddleware def initialize(app) @app = app end def call(env) Gorynich.instance.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
6 entries across 6 versions & 1 rubygems