namecom: MX record not set properly

This commit is contained in:
Girish Ramakrishnan
2018-05-24 09:38:01 -07:00
parent f1e6116b83
commit f9763b1ad3

View File

@@ -34,10 +34,16 @@ function addRecord(dnsConfig, zoneName, subdomain, type, values, callback) {
var data = {
host: subdomain,
type: type,
answer: values[0],
ttl: 300 // 300 is the lowest
};
if (type === 'MX') {
data.priority = parseInt(values[0].split(' ')[0], 10);
data.answer = values[0].split(' ')[1];
} else {
data.answer = values[0];
}
superagent.post(`${NAMECOM_API}/domains/${zoneName}/records`)
.auth(dnsConfig.username, dnsConfig.token)
.timeout(30 * 1000)
@@ -49,7 +55,7 @@ function addRecord(dnsConfig, zoneName, subdomain, type, values, callback) {
return callback(null, 'unused-id');
});
}
}
function updateRecord(dnsConfig, zoneName, recordId, subdomain, type, values, callback) {
assert.strictEqual(typeof dnsConfig, 'object');
@@ -65,10 +71,16 @@ function updateRecord(dnsConfig, zoneName, recordId, subdomain, type, values, ca
var data = {
host: subdomain,
type: type,
answer: values[0],
ttl: 300 // 300 is the lowest
};
if (type === 'MX') {
data.priority = parseInt(values[0].split(' ')[0], 10);
data.answer = values[0].split(' ')[1];
} else {
data.answer = values[0];
}
superagent.put(`${NAMECOM_API}/domains/${zoneName}/records/${recordId}`)
.auth(dnsConfig.username, dnsConfig.token)
.timeout(30 * 1000)