11# frozen_string_literal: true
22
3- require "active_support/configurable"
43require "logger"
54
65module CastleDevise
7- # Configuration object using {ActiveSupport::Configurable}
6+ # Configuration object
87 class Configuration
9- include ActiveSupport ::Configurable
10-
118 # @!attribute api_secret
129 # @return [String] Your API secret
13- config_accessor ( :api_secret )
10+ attr_accessor :api_secret
1411
1512 # @!attribute app_id
1613 # @return [String] Your Castle App ID
17- config_accessor ( :app_id )
14+ attr_accessor :app_id
1815
1916 # @!attribute monitoring_mode
2017 # When CastleDevise is in monitoring mode, it sends requests to Castle
@@ -25,27 +22,36 @@ class Configuration
2522 # from logging in/registering.
2623 #
2724 # @return [true, false] whether to act on deny requests or not
28- config_accessor ( :monitoring_mode ) { false }
25+ attr_accessor :monitoring_mode
2926
3027 # @!attribute logger
3128 # @return [Logger] A Logger instance. You might want to use Rails.logger here.
32- config_accessor ( :logger ) { Logger . new ( "/dev/null" ) }
29+ attr_accessor :logger
3330
3431 # @!attribute before_request_hooks
3532 # @return [Array<Proc>] Array of procs that will get called before a request to the Castle API
36- config_accessor ( :before_request_hooks ) { [ ] }
33+ attr_accessor :before_request_hooks
3734
3835 # @!attribute after_request_hooks
3936 # @return [Array<Proc>] Array of procs that will get called after a request to the Castle API
40- config_accessor ( :after_request_hooks ) { [ ] }
37+ attr_accessor :after_request_hooks
4138
4239 # @!attribute castle_sdk_facade_class
4340 # @return [Class] Castle API implementation
44- config_accessor ( :castle_sdk_facade_class ) { :: CastleDevise :: SdkFacade }
41+ attr_accessor :castle_sdk_facade_class
4542
4643 # @!attribute castle_client
4744 # @return [Class] Castle SDK client
48- config_accessor ( :castle_client ) { ::Castle ::Client . new }
45+ attr_accessor :castle_client
46+
47+ def initialize
48+ @monitoring_mode = false
49+ @logger = Logger . new ( "/dev/null" )
50+ @before_request_hooks = [ ]
51+ @after_request_hooks = [ ]
52+ @castle_sdk_facade_class = ::CastleDevise ::SdkFacade
53+ @castle_client = ::Castle ::Client . new
54+ end
4955
5056 # Adds a new before_request hook
5157 # @param blk [Proc]
0 commit comments