Guest User

Untitled

a guest
Nov 26th, 2018
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. # gem install dnsimple-ruby
  2. # $ <SPACE>PASSWORD="your password" EMAIL="your e-mail" ruby dnsimple_backup.rb > dnsimple_backup.yml
  3. # when you put a space before running a command you prevent it from being added to the history.
  4.  
  5. require "dnsimple"
  6. require "yaml"
  7.  
  8. DNSimple::Client.username = ENV.fetch("EMAIL")
  9. DNSimple::Client.password = ENV.fetch("PASSWORD")
  10.  
  11. domains = {}
  12.  
  13. DNSimple::Domain.all.each do |domain|
  14. domains[domain.name] ||= []
  15. records = domains[domain.name]
  16.  
  17. DNSimple::Record.all(domain).each do |record|
  18. records << {
  19. :name => record.name,
  20. :type => record.record_type,
  21. :content => record.content,
  22. :priority => record.prio,
  23. :ttl => record.ttl
  24. }
  25. end
  26. end
  27.  
  28. puts domains.to_yaml
Add Comment
Please, Sign In to add comment