CLOUDFLAREAPI: FIX: Preventing segfault when Cloudflare API limit is reached (#1530)

* Preventing segfault when Cloudflare API limit is reached

Signed-off-by: Jan-Philipp Benecke <jan-philipp@bnck.me>

* Add comment for future me

Signed-off-by: Jan-Philipp Benecke <jan-philipp@bnck.me>
This commit is contained in:
Jan-Philipp Benecke 2022-06-09 17:26:46 +02:00 committed by GitHub
parent 490f1d6184
commit 60324bc4f5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -150,9 +150,13 @@ func (c *cloudflareProvider) createRec(rec *models.RecordConfig, domainID string
} else if rec.Type == "DS" {
cf.Data = cfDSData(rec)
}
resp, err := c.cfClient.CreateDNSRecord(context.Background(), domainID, cf)
id = resp.Result.ID
return err
if resp, err := c.cfClient.CreateDNSRecord(context.Background(), domainID, cf); err != nil {
return err
} else {
// Updating id (from the outer scope) by side-effect, required for updating proxy mode
id = resp.Result.ID
return nil
}
},
}}
if rec.Metadata[metaProxy] != "off" {