mirror of
https://github.com/internetee/registry.git
synced 2025-08-16 06:23:57 +02:00
added dns validation job
This commit is contained in:
parent
53510cad43
commit
aa6e2e99ec
2 changed files with 14 additions and 4 deletions
8
app/jobs/dns_validation_job.rb
Normal file
8
app/jobs/dns_validation_job.rb
Normal 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
|
|
@ -6,8 +6,10 @@ class DNSValidator
|
||||||
|
|
||||||
attr_reader :domain, :results
|
attr_reader :domain, :results
|
||||||
|
|
||||||
def initialize(domain)
|
def initialize(domain:, name:)
|
||||||
@domain = domain
|
@domain = domain.present? ? domain : Domain.find_by_name(name)
|
||||||
|
raise "Domain not found" if @domain.blank?
|
||||||
|
|
||||||
@results = {
|
@results = {
|
||||||
nameservers: {},
|
nameservers: {},
|
||||||
dns_records: {},
|
dns_records: {},
|
||||||
|
@ -18,8 +20,8 @@ class DNSValidator
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.validate(domain)
|
def self.validate(domain:, name:)
|
||||||
new(domain).validate
|
new(domain: domain, name: name).validate
|
||||||
end
|
end
|
||||||
|
|
||||||
def validate
|
def validate
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue