zonesync 0.5.2 → 0.6.1

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: b84abff77df7d77d0f88940c816abfcc5b1082cda8083cbfcf5476f5e046c3e6
4
- data.tar.gz: 1f8c8c7bb693cadf2554cc6f5ff761c22d6d4f91da62d53f09ed9d3f4b986e96
3
+ metadata.gz: da2a32c21af6c64a37bdb9a998089318ba12cbf3e20e0699a757adafe23d6e29
4
+ data.tar.gz: 6614061b9bc864e1f5a6219d25ac96d93f45cf5a98a9234c75bc7241e51eb909
5
5
  SHA512:
6
- metadata.gz: 9734a3e1fcc8f9bef842f1cab50d2e4cd2f31d284b3a022c0aa7cbc165357fbada8f932ef87c89d74ee0721ad56cebaa84d582e8bc9bd2500a437d0612e21930
7
- data.tar.gz: e325c240e820c5417bdda7c65b7767ced3d1d373c20c5e37c976ba18052dedf140d694d5d03d99c8a41104f49b10a91532216470bc7ddfcf980eef6e2e859dbb
6
+ metadata.gz: c79134908c21f775a9aa58eccadd072684d0657b3e23bf9b953a050ef4c558cd557f9bbed9c57a522c7ab3e0521bd0a3254c19c8b2415a36c25e236be242a74c
7
+ data.tar.gz: 17d1e8928f168ea9bd4e93a9add850c2c5e7e7c168d3982d133817bdef63a9c085ae4d2b108aa8b51f1d5cab692f597d8d035aece15c7b44fa2547ad7baa0f91
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
 
@@ -47,7 +47,9 @@ module Zonesync
47
47
  if %w[CNAME MX].include?(attrs["type"])
48
48
  rdata = normalize_trailing_period(rdata)
49
49
  end
50
-
50
+ if %w[TXT SPF NAPTR].include?(attrs["type"])
51
+ rdata = normalize_quoting(rdata)
52
+ end
51
53
  Record.new(
52
54
  normalize_trailing_period(attrs["name"]),
53
55
  attrs["type"],
@@ -60,15 +62,21 @@ module Zonesync
60
62
  value =~ /\.$/ ? value : value + "."
61
63
  end
62
64
 
65
+ def normalize_quoting value
66
+ value =~ /^".+"$/ ? value : %("#{value}")
67
+ end
68
+
63
69
  def http
64
70
  return @http if @http
65
71
  @http = HTTP.new("https://api.cloudflare.com/client/v4/zones/#{credentials[:zone_id]}/dns_records")
66
72
  @http.before_request do |request|
67
73
  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|
74
+ if credentials[:token]
75
+ request["Authorization"] = "Bearer #{credentials[:token]}"
76
+ else
77
+ request["X-Auth-Email"] = credentials[:email]
78
+ request["X-Auth-Key"] = credentials[:key]
79
+ end
72
80
  end
73
81
  @http
74
82
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Zonesync
4
- VERSION = "0.5.2"
4
+ VERSION = "0.6.1"
5
5
  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.2
4
+ version: 0.6.1
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-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: dns-zonefile