make use of fqdn function
This commit is contained in:
+2
-3
@@ -225,15 +225,14 @@ async function registerLocations(locations, options, progressCallback) {
|
||||
const ipv6 = await network.getIPv6();
|
||||
|
||||
for (const location of locations) {
|
||||
const fqdn = `${location.subdomain ? (location.subdomain + '.') : ''}${location.domain}`;
|
||||
progressCallback({ message: `Registering location: ${fqdn}` });
|
||||
progressCallback({ message: `Registering location: ${fqdn(location.subdomain, location.domain)}` });
|
||||
|
||||
await promiseRetry({ times: 200, interval: 5000, debug, retry: (error) => error.retryable }, async function () {
|
||||
// cname records cannot co-exist with other records
|
||||
const [getError, values] = await safe(getDnsRecords(location.subdomain, location.domain, 'CNAME'));
|
||||
if (!getError && values.length === 1) {
|
||||
if (!options.overwriteDns) throw new BoxError(BoxError.ALREADY_EXISTS, 'DNS CNAME record already exists', { domain: location, retryable: false });
|
||||
debug(`registerLocations: removing CNAME record of ${fqdn}`);
|
||||
debug(`registerLocations: removing CNAME record of ${fqdn(location.subdomain, location.domain)}`);
|
||||
await removeDnsRecords(location.subdomain, location.domain, 'CNAME', values);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user