Created
June 6, 2016 15:15
-
-
Save bogdan/f0715a22b26584c53d24fe5f5bfb78a4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def custom_domain_up_new? | |
return false unless custom_domain.present? | |
Resolv::DNS.open do |dns| | |
dns.timeouts = 2 | |
# Querying each type of record individually | |
# Because ANY query may not return all required types | |
{ | |
Resolv::DNS::Resource::IN::CNAME => /(talkable|curebit)\.com$/, | |
Resolv::DNS::Resource::IN::NS => /ns-\d+.awsdns-\d+.com$/, | |
}.any? do |type, regex| | |
dns.getresources(custom_domain, type).any? do |record| | |
record.name.to_s =~ regex | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment