added dns validation job

This commit is contained in:
oleghasjanov 2025-08-07 11:26:32 +03:00
parent 53510cad43
commit aa6e2e99ec
2 changed files with 14 additions and 4 deletions

View file

@ -0,0 +1,8 @@
class DNSValidationJob < ApplicationJob
queue_as :default
def perform(domain_id)
domain = Domain.find(domain_id)
DNSValidator.validate(domain: domain, name: domain.name)
end
end

View file

@ -6,8 +6,10 @@ class DNSValidator
attr_reader :domain, :results
def initialize(domain)
@domain = domain
def initialize(domain:, name:)
@domain = domain.present? ? domain : Domain.find_by_name(name)
raise "Domain not found" if @domain.blank?
@results = {
nameservers: {},
dns_records: {},
@ -18,8 +20,8 @@ class DNSValidator
}
end
def self.validate(domain)
new(domain).validate
def self.validate(domain:, name:)
new(domain: domain, name: name).validate
end
def validate