mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2025-12-09 13:46:07 +08:00
REALTIMEREGISTER: Allow 0 prio for MX records (#3724)
Co-authored-by: pieterjan.eilers <pieterjan.eilers@realtimeregister.com>
This commit is contained in:
parent
e79c43f6eb
commit
2b2f9d901e
2 changed files with 6 additions and 2 deletions
|
|
@ -205,7 +205,7 @@ func (api *realtimeregisterAPI) createOrUpdateZone(body *Zone, url string) error
|
|||
return err
|
||||
}
|
||||
|
||||
// Ugly hack for MX records with null target
|
||||
// Workaround for 0 prio and 'omitempty' restrictions on json marshalling
|
||||
requestBody := strings.Replace(string(bodyBytes), "\"prio\":-1", "\"prio\":0", -1)
|
||||
|
||||
_, err = api.request("POST", url, strings.NewReader(requestBody))
|
||||
|
|
|
|||
|
|
@ -279,10 +279,14 @@ func toRecord(recordConfig *models.RecordConfig) Record {
|
|||
case "MX":
|
||||
if record.Content == "" {
|
||||
record.Content = "."
|
||||
record.Priority = -1
|
||||
record.Priority = 0
|
||||
} else {
|
||||
record.Priority = int(recordConfig.MxPreference)
|
||||
}
|
||||
// Workaround for 0 prio and 'omitempty' restrictions on json marshalling
|
||||
if record.Priority == 0 {
|
||||
record.Priority = -1
|
||||
}
|
||||
case "LOC":
|
||||
parts := strings.Fields(recordConfig.GetTargetCombined())
|
||||
degrees1, _ := strconv.ParseUint(parts[0], 10, 32)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue