mirror of
https://github.com/postalserver/postal.git
synced 2026-10-19 10:46:32 +00:00
refactor: refactor DNS resolution
This commit also adds some of tests for the Domain model. It was during the writing of these tests that the DNS resolution refactoring requirement became apparent.
This commit is contained in:
@@ -54,8 +54,7 @@ class TrackDomain < ApplicationRecord
|
||||
end
|
||||
|
||||
def check_dns
|
||||
result = domain.resolver.getresources(full_name, Resolv::DNS::Resource::IN::CNAME)
|
||||
records = result.map { |r| r.name.to_s.downcase }
|
||||
records = domain.resolver.cname(full_name)
|
||||
if records.empty?
|
||||
self.dns_status = "Missing"
|
||||
self.dns_error = "There is no record at #{full_name}"
|
||||
|
||||
Reference in New Issue
Block a user