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:
		
							parent
							
								
									7a60d3415f
								
							
						
					
					
						commit
						c720f7bca1
					
				@ -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())
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user