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:
@@ -253,6 +253,7 @@ async function verifyDomainConfig(domainObject) {
|
||||
// token can be api token or global api key
|
||||
if (!domainConfig.token || typeof domainConfig.token !== 'string') throw new BoxError(BoxError.BAD_FIELD, 'token must be a non-empty string');
|
||||
if (domainConfig.tokenType !== 'GlobalApiKey' && domainConfig.tokenType !== 'ApiToken') 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');
|
||||
|
||||
if (domainConfig.tokenType === 'GlobalApiKey') {
|
||||
if (typeof domainConfig.email !== 'string') throw new BoxError(BoxError.BAD_FIELD, 'email must be a non-empty string');
|
||||
@@ -266,7 +267,8 @@ async function verifyDomainConfig(domainObject) {
|
||||
token: domainConfig.token,
|
||||
tokenType: domainConfig.tokenType,
|
||||
email: domainConfig.email || null,
|
||||
defaultProxyStatus: domainConfig.defaultProxyStatus
|
||||
defaultProxyStatus: domainConfig.defaultProxyStatus,
|
||||
customNameservers: !!domainConfig.customNameservers
|
||||
};
|
||||
|
||||
if (constants.TEST) return sanitizedConfig; // this shouldn't be here
|
||||
@@ -279,7 +281,7 @@ async function verifyDomainConfig(domainObject) {
|
||||
|
||||
if (!_.isEqual(zone.name_servers.sort(), nameservers.sort())) {
|
||||
debug('verifyDomainConfig: %j and %j do not match', nameservers, zone.name_servers);
|
||||
throw new BoxError(BoxError.BAD_FIELD, 'Domain nameservers are not set to Cloudflare');
|
||||
if (!domainConfig.customNameservers) throw new BoxError(BoxError.BAD_FIELD, 'Domain nameservers are not set to Cloudflare');
|
||||
}
|
||||
|
||||
const location = 'cloudrontestdns';
|
||||
|
||||
Reference in New Issue
Block a user