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
@@ -230,6 +230,7 @@ async function verifyDomainConfig(domainObject) {
if (!domainConfig.accessKeyId || typeof domainConfig.accessKeyId !== 'string') throw new BoxError(BoxError.BAD_FIELD, 'accessKeyId must be a non-empty string');
if (!domainConfig.secretAccessKey || typeof domainConfig.secretAccessKey !== 'string') throw new BoxError(BoxError.BAD_FIELD, 'secretAccessKey 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 credentials = {
accessKeyId: domainConfig.accessKeyId,
@@ -237,6 +238,7 @@ async function verifyDomainConfig(domainObject) {
region: domainConfig.region || 'us-east-1',
endpoint: domainConfig.endpoint || null,
listHostedZonesByName: true, // new/updated creds require this perm
customNameservers: !!domainConfig.customNameservers
};
const ip = '127.0.0.1';
@@ -251,7 +253,7 @@ async function verifyDomainConfig(domainObject) {
if (!_.isEqual(zone.DelegationSet.NameServers.sort(), nameservers.sort())) {
debug('verifyDomainConfig: %j and %j do not match', nameservers, zone.DelegationSet.NameServers);
throw new BoxError(BoxError.BAD_FIELD, 'Domain nameservers are not set to Route53');
if (!domainConfig.customNameservers) throw new BoxError(BoxError.BAD_FIELD, 'Domain nameservers are not set to Route53');
}
const location = 'cloudrontestdns';