Method: KSConnect::Helpers#ip_address_for

Defined in:
lib/ksconnect/helpers.rb

#ip_address_for(domain_name) ⇒ Object



6
7
8
9
10
11
12
13
# File 'lib/ksconnect/helpers.rb', line 6

def ip_address_for(domain_name)
  if all_domains[domain_name]
    ip = all_domains[domain_name].ip_address
    Resolv::IPv4::Regex.match(ip) ? ip : "kloudsec.com" # go to something safe if ip is invalid
  else
    "kloudsec.com" # go to something safe if domain is missing
  end
end