class ActionHook::Core::Configuration

Constants

DEFAULT_HASH_HEADER_NAME
DEFAULT_OPEN_TIMEOUT_IN_SECONDS
DEFAULT_READ_TIMEOUT_IN_SECONDS

Attributes

allow_private_ips[RW]
blocked_custom_ip_ranges[W]
ca_file[RW]
hash_header_name[RW]
open_timeout[RW]
read_timeout[RW]

Public Class Methods

new(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 ) click to toggle source
# 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

Public Instance Methods

allow_all?() click to toggle source
# File lib/actionhook/core/configuration.rb, line 41
def allow_all?
  allow_private_ips && blocked_custom_ip_ranges.empty?
end
blocked_custom_ip_ranges() click to toggle source
# 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
net_http_options() click to toggle source
# File lib/actionhook/core/configuration.rb, line 29
def net_http_options
  {
    open_timeout: @open_timeout,
    read_timeout: @read_timeout,
    ca_file: @ca_file
  }.compact
end