Browse Source

Improve now alias UX in case of an external DNS and a CNAME entry

master
Olli Vanhoja 8 years ago
committed by Leo Lamprecht
parent
commit
548088111b
  1. 16
      lib/alias.js

16
lib/alias.js

@ -150,9 +150,19 @@ module.exports = class Alias extends Now {
if (domainInfo.verified) {
skipDNSVerification = true
} else if (domainInfo.uid) {
const e = new Error(`> The domain ${domain} is already registered with now but additional verification is needed, please refer to 'now domain --help'.`)
e.userError = true
throw e
const {verified, verifyToken, created} = await this.setupDomain(domain, {isExternal: true})
if (created && verified) {
console.log(`${chalk.cyan('> Success!')} Domain ${chalk.bold(chalk.underline(domain))} verified`)
} else if (verifyToken) {
const e = new Error(`> Verification required: Please add the following TXT record on the external DNS server: _now.${domain}: ${verifyToken}`)
e.userError = true
throw e
} else {
const e = new Error(`> Failed to verify the ownership of ${domain}, please refer to 'now domain --help'.`)
e.userError = true
throw e
}
}
}

Loading…
Cancel
Save