Module: ConsoleKit::TenantConfigurator
- Defined in:
- lib/console_kit/tenant_configurator.rb
Overview
For tenant configuration
Class Method Summary collapse
Class Method Details
.clear(context_class) ⇒ Object
24 25 26 27 28 29 |
# File 'lib/console_kit/tenant_configurator.rb', line 24 def clear(context_class) %i[tenant_shard tenant_mongo_db partner_identifier].each do |attr| context_class.public_send("#{attr}=", nil) end Output.print_info('Tenant context has been cleared.') end |
.configure_tenant(key, tenants, context_class) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/console_kit/tenant_configurator.rb', line 9 def configure_tenant(key, tenants, context_class) constants = tenants[key]&.[](:constants) return missing_config_error(key) unless constants validate_constants!(constants) apply_context(context_class, constants) setup_connections(context_class) Output.print_success("Tenant set to: #{key}") true rescue StandardError => e handle_error(e, key) false end |