Class: ActionHook::Core::Configuration
- Inherits:
-
Object
- Object
- ActionHook::Core::Configuration
- Defined in:
- lib/actionhook/core/configuration.rb
Constant Summary collapse
- DEFAULT_OPEN_TIMEOUT_IN_SECONDS =
5
- DEFAULT_READ_TIMEOUT_IN_SECONDS =
15
- DEFAULT_HASH_HEADER_NAME =
'SHA256-FINGERPRINT'
Instance Attribute Summary collapse
-
#allow_private_ips ⇒ Object
Returns the value of attribute allow_private_ips.
- #blocked_custom_ip_ranges ⇒ Object
-
#ca_file ⇒ Object
Returns the value of attribute ca_file.
-
#hash_header_name ⇒ Object
Returns the value of attribute hash_header_name.
-
#open_timeout ⇒ Object
Returns the value of attribute open_timeout.
-
#read_timeout ⇒ Object
Returns the value of attribute read_timeout.
Instance Method Summary collapse
- #allow_all? ⇒ Boolean
-
#initialize(open_timeout: DEFAULT_OPEN_TIMEOUT_IN_SECONDS, read_timeout: DEFAULT_READ_TIMEOUT_IN_SECONDS, hash_header_name: DEFAULT_HASH_HEADER_NAME, allow_private_ips: false, blocked_custom_ip_ranges: [], ca_file: nil) ⇒ Configuration
constructor
A new instance of Configuration.
- #net_http_options ⇒ Object
Constructor Details
#initialize(open_timeout: DEFAULT_OPEN_TIMEOUT_IN_SECONDS, read_timeout: DEFAULT_READ_TIMEOUT_IN_SECONDS, hash_header_name: DEFAULT_HASH_HEADER_NAME, allow_private_ips: false, blocked_custom_ip_ranges: [], ca_file: nil) ⇒ Configuration
Returns a new instance of Configuration.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/actionhook/core/configuration.rb', line 14 def initialize(open_timeout: DEFAULT_OPEN_TIMEOUT_IN_SECONDS, read_timeout: DEFAULT_READ_TIMEOUT_IN_SECONDS, hash_header_name: DEFAULT_HASH_HEADER_NAME, allow_private_ips: false, blocked_custom_ip_ranges: [], ca_file: nil ) @open_timeout = open_timeout @read_timeout = read_timeout @hash_header_name = hash_header_name @allow_private_ips = allow_private_ips @blocked_custom_ip_ranges = blocked_custom_ip_ranges || [] @ca_file = ca_file end |
Instance Attribute Details
#allow_private_ips ⇒ Object
Returns the value of attribute allow_private_ips.
9 10 11 |
# File 'lib/actionhook/core/configuration.rb', line 9 def allow_private_ips @allow_private_ips end |
#blocked_custom_ip_ranges ⇒ Object
37 38 39 |
# File 'lib/actionhook/core/configuration.rb', line 37 def blocked_custom_ip_ranges @memoized_blocked_custom_ip_ranges ||= @blocked_custom_ip_ranges&.map{|ip| IPAddr.new(ip)} || [] end |
#ca_file ⇒ Object
Returns the value of attribute ca_file.
9 10 11 |
# File 'lib/actionhook/core/configuration.rb', line 9 def ca_file @ca_file end |
#hash_header_name ⇒ Object
Returns the value of attribute hash_header_name.
9 10 11 |
# File 'lib/actionhook/core/configuration.rb', line 9 def hash_header_name @hash_header_name end |
#open_timeout ⇒ Object
Returns the value of attribute open_timeout.
9 10 11 |
# File 'lib/actionhook/core/configuration.rb', line 9 def open_timeout @open_timeout end |
#read_timeout ⇒ Object
Returns the value of attribute read_timeout.
9 10 11 |
# File 'lib/actionhook/core/configuration.rb', line 9 def read_timeout @read_timeout end |
Instance Method Details
#allow_all? ⇒ Boolean
41 42 43 |
# File 'lib/actionhook/core/configuration.rb', line 41 def allow_all? allow_private_ips && blocked_custom_ip_ranges.empty? end |
#net_http_options ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/actionhook/core/configuration.rb', line 29 def { open_timeout: @open_timeout, read_timeout: @read_timeout, ca_file: @ca_file }.compact end |