Repository: favonia/cloudflare-ddns
Pull request #534 (2023-06-20 11:43:19)

docs: update links to Cloudflare API

codecov[bot]: ## [Codecov](https://app.codecov.io/gh/favonia/cloudflare-ddns/pull/534?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=favonia) Report
> Merging [#534](https://app.codecov.io/gh/favonia/cloudflare-ddns/pull/534?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=favonia) (e66b48e) into [main](https://app.codecov.io/gh/favonia/cloudflare-ddns/commit/9f2cdb44990f3d98a390ccaaa881b6449ed0f1b6?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=favonia) (9f2cdb4) will **increase** coverage by `0.00%`.
> The diff coverage is `100.00%`.

```diff
@@           Coverage Diff           @@
##             main     #534   +/-   ##
=======================================
  Coverage   87.74%   87.75%           
=======================================
  Files          43       43           
  Lines        2163     2164    +1     
=======================================
+ Hits         1898     1899    +1     
  Misses        256      256           
  Partials        9        9           
```

| Flag | Coverage Δ | |
|---|---|---|
| unittests | `87.75% <100.00%> (+<0.01%)` | :arrow_up: |

Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=favonia#carryforward-flags-in-the-pull-request-comment) to find out more.

| [Impacted Files](https://app.codecov.io/gh/favonia/cloudflare-ddns/pull/534?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=favonia) | Coverage Δ | |
|---|---|---|
| [internal/config/env\_base.go](https://app.codecov.io/gh/favonia/cloudflare-ddns/pull/534?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=favonia#diff-aW50ZXJuYWwvY29uZmlnL2Vudl9iYXNlLmdv) | `100.00% <ø> (ø)` | |
| [internal/api/cloudflare.go](https://app.codecov.io/gh/favonia/cloudflare-ddns/pull/534?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=favonia#diff-aW50ZXJuYWwvYXBpL2Nsb3VkZmxhcmUuZ28=) | `100.00% <100.00%> (ø)` | |

:mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=favonia)


Patch:
diff --git a/internal/api/cloudflare.go b/internal/api/cloudflare.go
index e710cfe..1706813 100644
--- a/internal/api/cloudflare.go
+++ b/internal/api/cloudflare.go
@@ -108,7 +108,8 @@ func (h *CloudflareHandle) ActiveZones(ctx context.Context, ppfmt pp.PP, name st
 
 	ids := make([]string, 0, len(res.Result))
 	for _, zone := range res.Result {
-		// see https://api.cloudflare.com/#zone-list-zones for possible statuses
+		// The list of possible statuses was at https://api.cloudflare.com/#zone-list-zones
+		// but the documentation is missing now.
 		switch zone.Status {
 		case "active": // fully working
 			ids = append(ids, zone.ID)
@@ -156,8 +157,8 @@ zoneSearch:
 			h.cache.zoneOfDomain.Set(domain.DNSNameASCII(), zones[0], ttlcache.DefaultTTL)
 			return zones[0], true
 		default: // len(zones) > 1
-			ppfmt.Warningf(pp.EmojiImpossible,
-				"Found multiple active zones named %q. Specifying CF_ACCOUNT_ID might help", zoneName)
+			ppfmt.Warningf(pp.EmojiImpossible, "Found multiple active zones named %q. Specifying CF_ACCOUNT_ID might help", zoneName)                    //nolint:lll
+			ppfmt.Warningf(pp.EmojiImpossible, "Please consider reporting this rare situation at https://github.com/favonia/cloudflare-ddns/issues/new") //nolint:lll
 			return "", false
 		}
 	}
diff --git a/internal/config/env_base.go b/internal/config/env_base.go
index d106d84..12e6a49 100644
--- a/internal/config/env_base.go
+++ b/internal/config/env_base.go
@@ -144,7 +144,7 @@ func ReadNonnegInt(ppfmt pp.PP, key string, field *int) bool {
 // According to [DNS documentation], the valid range is "Auto" and [30, 86400].
 // We thus accept the union of both ranges---1 (auto) and [30, 86400].
 //
-// [API documentation]: https://api.cloudflare.com/#dns-records-for-a-zone-create-dns-record
+// [API documentation]: https://developers.cloudflare.com/api/operations/dns-records-for-a-zone-create-dns-record
 // [DNS documentation]: https://developers.cloudflare.com/dns/manage-dns-records/reference/ttl
 func ReadTTL(ppfmt pp.PP, key string, field *api.TTL) bool {
 	val := Getenv(key)


Test patch:
diff --git a/internal/api/cloudflare_test.go b/internal/api/cloudflare_test.go
index b8f4f0a..03fc5b2 100644
--- a/internal/api/cloudflare_test.go
+++ b/internal/api/cloudflare_test.go
@@ -381,10 +381,16 @@ func TestZoneOfDomain(t *testing.T) {
 			map[string][]string{"test.org": {"active", "active"}},
 			2, "", false,
 			func(m *mocks.MockPP) {
-				m.EXPECT().Warningf(
-					pp.EmojiImpossible,
-					"Found multiple active zones named %q. Specifying CF_ACCOUNT_ID might help",
-					"test.org",
+				gomock.InOrder(
+					m.EXPECT().Warningf(
+						pp.EmojiImpossible,
+						"Found multiple active zones named %q. Specifying CF_ACCOUNT_ID might help",
+						"test.org",
+					),
+					m.EXPECT().Warningf(
+						pp.EmojiImpossible,
+						"Please consider reporting this rare situation at https://github.com/favonia/cloudflare-ddns/issues/new",
+					),
 				)
 			},
 		},
@@ -393,10 +399,16 @@ func TestZoneOfDomain(t *testing.T) {
 			map[string][]string{"test.org": {"active", "active"}},
 			1, "", false,
 			func(m *mocks.MockPP) {
-				m.EXPECT().Warningf(
-					pp.EmojiImpossible,
-					"Found multiple active zones named %q. Specifying CF_ACCOUNT_ID might help",
-					"test.org",
+				gomock.InOrder(
+					m.EXPECT().Warningf(
+						pp.EmojiImpossible,
+						"Found multiple active zones named %q. Specifying CF_ACCOUNT_ID might help",
+						"test.org",
+					),
+					m.EXPECT().Warningf(
+						pp.EmojiImpossible,
+						"Please consider reporting this rare situation at https://github.com/favonia/cloudflare-ddns/issues/new",
+					),
 				)
 			},
 		},