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
+3 -1
View File
@@ -140,10 +140,12 @@ async function verifyDomainConfig(domainObject) {
if (!domainConfig.token || typeof domainConfig.token !== 'string') throw new BoxError(BoxError.BAD_FIELD, 'token must be a non-empty string');
if (domainConfig.tokenType !== 'PAT' && domainConfig.tokenType !== 'ApiKey') throw new BoxError(BoxError.BAD_FIELD, 'tokenType is required');
if ('customNameservers' in domainConfig && typeof domainConfig.customNameservers !== 'boolean') throw new BoxError(BoxError.BAD_FIELD, 'customNameservers must be a boolean');
const credentials = {
token: domainConfig.token,
tokenType: domainConfig.tokenType,
customNameservers: !!domainConfig.customNameservers
};
const ip = '127.0.0.1';
@@ -156,7 +158,7 @@ async function verifyDomainConfig(domainObject) {
if (!nameservers.every(function (n) { return n.toLowerCase().indexOf('.gandi.net') !== -1; })) {
debug('verifyDomainConfig: %j does not contain Gandi NS', nameservers);
throw new BoxError(BoxError.BAD_FIELD, 'Domain nameservers are not set to Gandi');
if (!domainConfig.customNameservers) throw new BoxError(BoxError.BAD_FIELD, 'Domain nameservers are not set to Gandi');
}
const location = 'cloudrontestdns';