mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2024-05-11 05:55:12 +00:00
Cloudflare: Add support for MX priorities of "" (0) (#374)
* Cloudflare: Add support for MX priorities of "" (0)
This commit is contained in:
committed by
Tom Limoncelli
parent
921fa98490
commit
6ace5e2b4b
@ -385,10 +385,14 @@ func (c *cfRecord) nativeToRecord(domain string) *models.RecordConfig {
|
|||||||
switch rType := c.Type; rType { // #rtype_variations
|
switch rType := c.Type; rType { // #rtype_variations
|
||||||
case "MX":
|
case "MX":
|
||||||
var priority uint16
|
var priority uint16
|
||||||
if p, err := c.Priority.Int64(); err != nil {
|
if c.Priority == "" {
|
||||||
panic(errors.Wrap(err, "error decoding priority from cloudflare record"))
|
priority = 0
|
||||||
} else {
|
} else {
|
||||||
priority = uint16(p)
|
if p, err := c.Priority.Int64(); err != nil {
|
||||||
|
panic(errors.Wrap(err, "error decoding priority from cloudflare record"))
|
||||||
|
} else {
|
||||||
|
priority = uint16(p)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if err := rc.SetTargetMX(priority, c.Content); err != nil {
|
if err := rc.SetTargetMX(priority, c.Content); err != nil {
|
||||||
panic(errors.Wrap(err, "unparsable MX record received from cloudflare"))
|
panic(errors.Wrap(err, "unparsable MX record received from cloudflare"))
|
||||||
|
Reference in New Issue
Block a user