Adding simple tools, just to show how to use classes.
This commit is contained in:
parent
ebaf7dfb36
commit
ce74c1c2c1
28
tools/test-storage.cr
Normal file
28
tools/test-storage.cr
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
require "./src/storage.cr"
|
||||||
|
|
||||||
|
alias DSZ = DNSManager::Storage::Zone
|
||||||
|
|
||||||
|
storage = DNSManager::Storage.new "STORAGE"
|
||||||
|
|
||||||
|
user_data = DNSManager::Storage::UserData.new 1004
|
||||||
|
storage.user_data << user_data rescue nil
|
||||||
|
|
||||||
|
zone = DSZ.new "test.my-domain.com"
|
||||||
|
|
||||||
|
a_record = DSZ::A.new "www", 600.to_u32, "127.0.0.1"
|
||||||
|
aaaa_record = DSZ::AAAA.new "www", 600.to_u32, "::1"
|
||||||
|
mx_record = DSZ::MX.new "mail", 600.to_u32, "127.0.0.1", 5.to_u32
|
||||||
|
|
||||||
|
zone.resources << a_record
|
||||||
|
zone.resources << aaaa_record
|
||||||
|
zone.resources << mx_record
|
||||||
|
|
||||||
|
storage.new_domain 1004, zone
|
||||||
|
|
||||||
|
pp! storage.user_data
|
||||||
|
puts "Zones !!!"
|
||||||
|
pp! storage.zones
|
||||||
|
storage.zones.to_a.each do |z|
|
||||||
|
pp! z
|
||||||
|
end
|
||||||
|
|
7
tools/zone_from_json.cr
Normal file
7
tools/zone_from_json.cr
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
require "./src/storage.cr"
|
||||||
|
|
||||||
|
|
||||||
|
alias DSZ = DNSManager::Storage::Zone
|
||||||
|
|
||||||
|
zone = DSZ.from_json File.read(ARGV[0])
|
||||||
|
pp! zone
|
Loading…
Reference in New Issue
Block a user