domains: add option to set custom/vanity nameservers

this flag skips the NS name validation when a custom nameserver is set
i.e not to the provider's NS but uses the provider's API.
This commit is contained in:
Girish Ramakrishnan
2025-03-02 07:27:09 +01:00
parent 085ed59334
commit 6aca198428
28 changed files with 156 additions and 61 deletions
+4 -2
View File
@@ -237,11 +237,13 @@ async function verifyDomainConfig(domainObject) {
zoneName = domainObject.zoneName;
if (!domainConfig.token || typeof domainConfig.token !== 'string') throw new BoxError(BoxError.BAD_FIELD, 'token must be a non-empty string');
if ('customNameservers' in domainConfig && typeof domainConfig.customNameservers !== 'boolean') throw new BoxError(BoxError.BAD_FIELD, 'customNameservers must be a boolean');
const ip = '127.0.0.1';
const credentials = {
token: domainConfig.token
token: domainConfig.token,
customNameservers: !!domainConfig.customNameservers
};
if (constants.TEST) return credentials; // this shouldn't be here
@@ -252,7 +254,7 @@ async function verifyDomainConfig(domainObject) {
if (nameservers.map(function (n) { return n.toLowerCase(); }).indexOf('ns1.linode.com') === -1) {
debug('verifyDomainConfig: %j does not contains linode NS', nameservers);
throw new BoxError(BoxError.BAD_FIELD, 'Domain nameservers are not set to Linode');
if (!domainConfig.customNameservers) throw new BoxError(BoxError.BAD_FIELD, 'Domain nameservers are not set to Linode');
}
const location = 'cloudrontestdns';