Class: PgMultitenantSchemas::Configuration
- Inherits:
-
Object
- Object
- PgMultitenantSchemas::Configuration
- Defined in:
- lib/pg_multitenant_schemas/configuration.rb
Overview
Configuration class for PgMultitenantSchemas gem settings. Manages tenant resolution, schema switching behavior, and Rails integration options.
Instance Attribute Summary collapse
-
#auto_create_schemas ⇒ Object
Returns the value of attribute auto_create_schemas.
-
#common_tlds ⇒ Object
Returns the value of attribute common_tlds.
-
#connection_class ⇒ Object
Returns the value of attribute connection_class.
-
#default_schema ⇒ Object
Returns the value of attribute default_schema.
-
#development_fallback ⇒ Object
Returns the value of attribute development_fallback.
-
#excluded_subdomains ⇒ Object
Returns the value of attribute excluded_subdomains.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#tenant_model_class ⇒ Object
Returns the value of attribute tenant_model_class.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #tenant_model ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/pg_multitenant_schemas/configuration.rb', line 12 def initialize @tenant_model_class = "Tenant" @default_schema = "public" # Enable development fallback with cookie support by default in development @development_fallback = false begin @development_fallback = ::Rails.env&.development? == true if defined?(::Rails) rescue StandardError # If Rails is not available, keep default end @excluded_subdomains = %w[www api admin mail ftp blog support help docs staging] @common_tlds = %w[com org net edu gov mil int co uk ca au de fr jp cn dev test] @auto_create_schemas = true @connection_class = "ApplicationRecord" @logger = defined?(::Rails) && ::Rails.respond_to?(:logger) ? ::Rails.logger : nil end |
Instance Attribute Details
#auto_create_schemas ⇒ Object
Returns the value of attribute auto_create_schemas.
8 9 10 |
# File 'lib/pg_multitenant_schemas/configuration.rb', line 8 def auto_create_schemas @auto_create_schemas end |
#common_tlds ⇒ Object
Returns the value of attribute common_tlds.
8 9 10 |
# File 'lib/pg_multitenant_schemas/configuration.rb', line 8 def common_tlds @common_tlds end |
#connection_class ⇒ Object
Returns the value of attribute connection_class.
8 9 10 |
# File 'lib/pg_multitenant_schemas/configuration.rb', line 8 def connection_class @connection_class end |
#default_schema ⇒ Object
Returns the value of attribute default_schema.
8 9 10 |
# File 'lib/pg_multitenant_schemas/configuration.rb', line 8 def default_schema @default_schema end |
#development_fallback ⇒ Object
Returns the value of attribute development_fallback.
8 9 10 |
# File 'lib/pg_multitenant_schemas/configuration.rb', line 8 def development_fallback @development_fallback end |
#excluded_subdomains ⇒ Object
Returns the value of attribute excluded_subdomains.
8 9 10 |
# File 'lib/pg_multitenant_schemas/configuration.rb', line 8 def excluded_subdomains @excluded_subdomains end |
#logger ⇒ Object
Returns the value of attribute logger.
8 9 10 |
# File 'lib/pg_multitenant_schemas/configuration.rb', line 8 def logger @logger end |
#tenant_model_class ⇒ Object
Returns the value of attribute tenant_model_class.
8 9 10 |
# File 'lib/pg_multitenant_schemas/configuration.rb', line 8 def tenant_model_class @tenant_model_class end |
Instance Method Details
#tenant_model ⇒ Object
29 30 31 |
# File 'lib/pg_multitenant_schemas/configuration.rb', line 29 def tenant_model @tenant_model ||= tenant_model_class.constantize end |