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
|
||||
case "MX":
|
||||
var priority uint16
|
||||
if p, err := c.Priority.Int64(); err != nil {
|
||||
panic(errors.Wrap(err, "error decoding priority from cloudflare record"))
|
||||
if c.Priority == "" {
|
||||
priority = 0
|
||||
} 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 {
|
||||
panic(errors.Wrap(err, "unparsable MX record received from cloudflare"))
|
||||
|
Reference in New Issue
Block a user