mirror of
https://github.com/tiennm99/is-a-dev.git
synced 2026-08-21 08:26:08 +00:00
mx: adds automatic priority for mx record lists + publishing
This commit is contained in:
@@ -10,18 +10,19 @@ const toHostList = R.chain(data => {
|
||||
const rs = getRecords(data.record);
|
||||
|
||||
return R.chain(([recordType, urls]) =>
|
||||
(Array.isArray(urls) ? urls : [urls]).map(url => ({
|
||||
(Array.isArray(urls) ? urls : [urls]).map((url, index) => ({
|
||||
name: data.name,
|
||||
type: recordType,
|
||||
address: (recordType === 'CNAME' ? `${url}`.toLowerCase() : `${url}`).replace(/\/$/g, ''),
|
||||
ttl: TTL,
|
||||
...(recordType === 'MX' ? { priority: index + 20 } : {})
|
||||
}))
|
||||
, rs);
|
||||
, rs);
|
||||
});
|
||||
|
||||
const registerDomains = async ({ domainService, getDomains, log = () => {} }) => {
|
||||
const registerDomains = async ({ domainService, getDomains, log = () => { } }) => {
|
||||
const domains = await getDomains().then(toHostList);
|
||||
|
||||
|
||||
if (domains.length === 0)
|
||||
return Promise.reject(new Error('Nothing to register'));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user