diff --git a/lib/alias.js b/lib/alias.js index b988f7d..c58bdf9 100644 --- a/lib/alias.js +++ b/lib/alias.js @@ -119,12 +119,26 @@ export default class Alias extends Now { if (isZeitWorld(nameservers)) { console.log(`> Detected ${chalk.bold(chalk.underline('zeit.world'))} nameservers! Configuring records.`); const record = alias.substr(0, alias.length - domain.length); - await this.setupRecord(domain, record); + + // lean up trailing and leading dots + const _record = record + .replace(/^\./, '') + .replace(/\.$/, ''); + const _domain = domain + .replace(/^\./, '') + .replace(/\.$/, ''); + + if (_record === '') { + await this.setupRecord(_domain, '*'); + } + + await this.setupRecord(_domain, _record); + this.recordSetup = true; console.log('> DNS Configured! Verifying propagation…'); try { - await this.retry(() => this.verifyOwnership(alias), { retries: 10, maxTimeout: 3000 }); + await this.retry(() => this.verifyOwnership(alias), { retries: 10, maxTimeout: 8000 }); } catch (err2) { const e = new Error('> We configured the DNS settings for your alias, but we were unable to ' + 'verify that they\'ve propagated. Please try the alias again later.'); @@ -228,12 +242,6 @@ export default class Alias extends Now { async setupRecord (domain, name) { await this.setupDomain(domain); - // lean up trailing and leading dots - name = name.replace(/^\./, ''); - name = name.replace(/\.$/, ''); - domain = domain.replace(/^\./, ''); - domain = domain.replace(/\.$/, ''); - if (this._debug) console.log(`> [debug] Setting up record "${name}" for "${domain}"`); const type = '' === name ? 'ALIAS' : 'CNAME'; return this.retry(async (bail, attempt) => {