zonesync 0.5.1 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9fc9d61a62a3b6c41fc4f1f77d2ce56f4997e66ef3c1803d46e5c7a500472509
4
- data.tar.gz: 2fbc51c3f1ba373b5562ddaf8bbcca9691ac303d347e0a7b22fdaa77ff8e39ad
3
+ metadata.gz: 9d4c787f0f82dabd1145741b2621cc6e5c4c7b019f83918349aba92cde05b445
4
+ data.tar.gz: 6cc9654056a88bf0233b2a9311145388771d7cbe432dd741e0603c1f6d9702de
5
5
  SHA512:
6
- metadata.gz: 2ebf4960b54b1ae4ef76288d4a1065a88be3310b4b13e3fdc88e78630622e38ed3ea10e36e08a4679d257e7ab5d0bad56366cd310a3bce55a2800862d79f4dcc
7
- data.tar.gz: 7d153cb83948a650cf0c16b4fa582172b5484325bee65e7edc1228a6716942e46bdee1a168b716f36c117b6f70df786da82b24c12b5d37c86f80216a22ff4d3a
6
+ metadata.gz: bae5201c55f2d24e8915ba14bdc6dab7104960b4e21615056826f692983e9385d2b386c120d146b5e195e93a61736eeb1c081eef9c8bc524631bbd1ec18aff08
7
+ data.tar.gz: ec58e33d0960cf7847bb53a7c26d6e534a2ad0c34459067dd7ee0eb3c00338c98004453ff3d0a81f33d754a96145f24e0ce315e076fde987591806b3ee3d7e40
data/README.md CHANGED
@@ -58,9 +58,12 @@ We need to tell `zonesync` about our DNS host by building a small YAML file. The
58
58
 
59
59
  ```
60
60
  provider: Cloudflare
61
+ zone_id: <CLOUDFLARE_DOMAIN_ZONE_ID>
62
+ token: <CLOUDFLARE_API_TOKEN>
63
+ # or instead of token you can auth with:
61
64
  email: <CLOUDFLARE_EMAIL>
62
65
  key: <CLOUDFLARE_API_KEY>
63
- ```
66
+ ``
64
67
 
65
68
  **Route 53**
66
69
 
@@ -65,10 +65,12 @@ module Zonesync
65
65
  @http = HTTP.new("https://api.cloudflare.com/client/v4/zones/#{credentials[:zone_id]}/dns_records")
66
66
  @http.before_request do |request|
67
67
  request["Content-Type"] = "application/json"
68
- request["X-Auth-Email"] = credentials[:email]
69
- request["X-Auth-Key"] = credentials[:key]
70
- end
71
- @http.after_response do |response|
68
+ if credentials[:token]
69
+ request["Authorization"] = "Bearer #{credentials[:token]}"
70
+ else
71
+ request["X-Auth-Email"] = credentials[:email]
72
+ request["X-Auth-Key"] = credentials[:key]
73
+ end
72
74
  end
73
75
  @http
74
76
  end
data/lib/zonesync/diff.rb CHANGED
@@ -11,11 +11,11 @@ module Zonesync
11
11
  changes.map do |change|
12
12
  case change.action
13
13
  when "-"
14
- [:remove, change.old_element.to_h]
14
+ [:remove, [change.old_element.to_h]]
15
15
  when "!"
16
16
  [:change, [change.old_element.to_h, change.new_element.to_h]]
17
17
  when "+"
18
- [:add, change.new_element.to_h]
18
+ [:add, [change.new_element.to_h]]
19
19
  end
20
20
  end.compact
21
21
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Zonesync
4
- VERSION = "0.5.1"
4
+ VERSION = "0.6.0"
5
5
  end
data/lib/zonesync.rb CHANGED
@@ -36,7 +36,7 @@ module Zonesync
36
36
  operations = Diff.call(from: destination, to: source)
37
37
  operations.each do |method, args|
38
38
  Logger.log(method, args, dry_run: dry_run)
39
- destination.send(method, args) unless dry_run
39
+ destination.send(method, *args) unless dry_run
40
40
  end
41
41
  end
42
42
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zonesync
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Micah Geisel
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2024-02-06 00:00:00.000000000 Z
12
+ date: 2024-04-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: dns-zonefile