Class: BetterAuth::Rails::Configuration
- Inherits:
-
Object
- Object
- BetterAuth::Rails::Configuration
- Defined in:
- lib/better_auth/rails/configuration.rb
Constant Summary collapse
- AUTH_OPTION_NAMES =
%i[ app_name base_url base_path secret database plugins trusted_origins rate_limit session account user verification advanced email_and_password password_hasher email_verification social_providers experimental secondary_storage database_hooks hooks on_api_error disabled_paths logger ].freeze
- BLOCK_OPTION_NAMES =
%i[ rate_limit session account user verification advanced email_and_password email_verification social_providers experimental database_hooks hooks on_api_error ].freeze
Instance Method Summary collapse
- #database_adapter=(adapter) ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #to_auth_options ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
61 62 63 64 65 66 |
# File 'lib/better_auth/rails/configuration.rb', line 61 def initialize @base_path = BetterAuth::Configuration::DEFAULT_BASE_PATH @plugins = [] @trusted_origins = [] @database = ->() { ActiveRecordAdapter.new() } end |
Instance Method Details
#database_adapter=(adapter) ⇒ Object
68 69 70 71 72 73 74 75 |
# File 'lib/better_auth/rails/configuration.rb', line 68 def database_adapter=(adapter) case adapter&.to_sym when :active_record self.database = ->() { ActiveRecordAdapter.new() } else raise ArgumentError, "Unsupported database_adapter: #{adapter.inspect}. Use :active_record or assign a custom adapter with config.database = ..." end end |
#to_auth_options ⇒ Object
77 78 79 80 81 82 83 84 85 |
# File 'lib/better_auth/rails/configuration.rb', line 77 def AUTH_OPTION_NAMES.each_with_object({}) do |name, | value = public_send(name) next if value.nil? next if value.respond_to?(:empty?) && value.empty? [name] = value end end |