Class: BetterAuth::Hanami::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/better_auth/hanami/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

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



35
36
37
38
39
40
# File 'lib/better_auth/hanami/configuration.rb', line 35

def initialize
  @base_path = BetterAuth::Configuration::DEFAULT_BASE_PATH
  @plugins = []
  @trusted_origins = []
  @database = ->(options) { SequelAdapter.from_hanami(options) }
end

Instance Method Details

#to_auth_optionsObject



42
43
44
45
46
47
48
49
50
# File 'lib/better_auth/hanami/configuration.rb', line 42

def to_auth_options
  AUTH_OPTION_NAMES.each_with_object({}) do |name, options|
    value = public_send(name)
    next if value.nil?
    next if value.respond_to?(:empty?) && value.empty?

    options[name] = value
  end
end