Class: Configurable::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/configurable.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/configurable.rb', line 34

def initialize
  @is_datadome_assessment_enabled = lambda { true }
  @logger = Logger.new($stdout)
  @visible_endpoints_regex = lambda { ENV.fetch('DATADOME_URL_PATTERN_INCLUSION', ALL_ENDPOINT_INCLUSION_REGEXP).to_s }
  @hidden_endpoints_regex = lambda { ENV.fetch('DATADOME_URL_PATTERN_EXCLUSION', STATIC_PAGE_EXCLUSION_REGEXP).to_s }
  @datadome_timeout = lambda { ENV.fetch('DATADOME_TIMEOUT', 300).to_i }
  @datadome_read_timeout = lambda { ENV.fetch('DATADOME_READ_TIMEOUT', 200).to_i }
  @custom_datadome_payload_headers = {}
  @custom_payload = lambda { {} }
  @protection_api_host = ENV.fetch('DATADOME_ENDPOINT', 'api.datadome.co')
  @datadome_server_side_key = lambda { ENV['DATADOME_SERVER_SIDE_KEY'] }
end

Instance Attribute Details

#custom_datadome_payload_headersObject

Returns the value of attribute custom_datadome_payload_headers.



23
24
25
# File 'lib/configurable.rb', line 23

def custom_datadome_payload_headers
  @custom_datadome_payload_headers
end

#custom_payloadObject

Returns the value of attribute custom_payload.



23
24
25
# File 'lib/configurable.rb', line 23

def custom_payload
  @custom_payload
end

#datadome_read_timeoutObject

Returns the value of attribute datadome_read_timeout.



23
24
25
# File 'lib/configurable.rb', line 23

def datadome_read_timeout
  @datadome_read_timeout
end

#datadome_server_side_keyObject

Returns the value of attribute datadome_server_side_key.



23
24
25
# File 'lib/configurable.rb', line 23

def datadome_server_side_key
  @datadome_server_side_key
end

#datadome_timeoutObject

Returns the value of attribute datadome_timeout.



23
24
25
# File 'lib/configurable.rb', line 23

def datadome_timeout
  @datadome_timeout
end

#hidden_endpoints_regexObject

Returns the value of attribute hidden_endpoints_regex.



23
24
25
# File 'lib/configurable.rb', line 23

def hidden_endpoints_regex
  @hidden_endpoints_regex
end

#is_datadome_assessment_enabledObject

Returns the value of attribute is_datadome_assessment_enabled.



23
24
25
# File 'lib/configurable.rb', line 23

def is_datadome_assessment_enabled
  @is_datadome_assessment_enabled
end

#loggerObject

Returns the value of attribute logger.



23
24
25
# File 'lib/configurable.rb', line 23

def logger
  @logger
end

#protection_api_hostObject

Returns the value of attribute protection_api_host.



23
24
25
# File 'lib/configurable.rb', line 23

def protection_api_host
  @protection_api_host
end

#visible_endpoints_regexObject

Returns the value of attribute visible_endpoints_regex.



23
24
25
# File 'lib/configurable.rb', line 23

def visible_endpoints_regex
  @visible_endpoints_regex
end