1
0
mirror of https://github.com/taigrr/godns synced 2025-01-18 04:03:25 -08:00

Fix API token permission issue with CloudFlare

When querying CloudFlare for all zones via the API using a restricted API token, CloudFlare responds, that that particular token needs the "com.cloudflare.api.account.zone.list" permission, in order to successfully retrieve all zones.
Adding the parameter "name" with the value of the given domain works around that limitation, as then the API token only needs access to that particular domain.
This commit is contained in:
Marvin
2020-11-06 20:35:40 +01:00
committed by GitHub
parent 7a60d3415f
commit c720f7bca1

View File

@@ -163,7 +163,7 @@ func (handler *Handler) getZone(domain string) string {
var z ZoneResponse
req, client := handler.newRequest("GET", "/zones", nil)
req, client := handler.newRequest("GET", fmt.Sprintf("/zones?name=%s", domain), nil)
resp, err := client.Do(req)
if err != nil {
log.Println("Request error:", err.Error())