Skip to content

Commit

Permalink
Improve now alias UX in case of an external DNS and a CNAME entry
Browse files Browse the repository at this point in the history
  • Loading branch information
OlliV authored and leo committed Jan 28, 2017
1 parent add7bcf commit 5480881
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions lib/alias.js
Expand Up @@ -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
}
}
}

Expand Down

0 comments on commit 5480881

Please sign in to comment.