update server
This commit is contained in:
@ -9,7 +9,7 @@ class DnsUpdateJob < ApplicationJob
|
||||
Rails.application.credentials.simple_id
|
||||
end
|
||||
def my_ip
|
||||
HTTParty.get("http://icanhazip.com").strip
|
||||
HTTParty.get("https://jsonip.com/")["ip"]
|
||||
end
|
||||
|
||||
def find_record(name , host)
|
||||
@ -17,6 +17,10 @@ class DnsUpdateJob < ApplicationJob
|
||||
zones.data.first
|
||||
end
|
||||
|
||||
def same_ip
|
||||
my_ip == find_record("gateway" , "hubfeenix.fi").content
|
||||
end
|
||||
|
||||
def update_ip
|
||||
record = find_record("gateway" , "hubfeenix.fi")
|
||||
client.zones.update_zone_record(simple_id,"hubfeenix.fi", record.id , content: my_ip)
|
||||
|
Reference in New Issue
Block a user