@ -76,6 +76,8 @@ export default class Alias extends Now {
}
asyncset(deployment,alias){
alias=alias.toLowerCase();
constdepl=awaitthis.findDeployment(deployment);
if(!depl){
consterr=newError(`Deployment not found by "${deployment}". Run ${chalk.dim('`now ls`')} to see your deployments.`);
@ -91,11 +93,21 @@ export default class Alias extends Now {
alias=toHost(alias);
}
awaitthis.createAlias(depl,alias);
console.log(`${chalk.cyan('> Success!')} Set up alias ${chalk.bold(alias)}`);
if(!/\.now\.sh$/.test(alias)){
console.log(`> ${chalk.bold(chalk.underline(alias))} is a custom domain.`);
console.log(`> Verifying that ${chalk.bold(chalk.underline(alias))} has a ${chalk.cyan('`CNAME`')} or ${chalk.cyan('`ALIAS`')} record pointing to ${chalk.bold(chalk.underline('alias.zeit.co'))}.`);
console.log(`${chalk.cyan('> Success!')} Alias created ${chalk.dim(`(${uid})`)}: ${chalk.bold(`https://${depl.url}`)}${chalk.dim(`(${depl.uid})`)} now points to ${chalk.bold(chalk.underline(`https://${alias}`))}`);
}else{
console.log(`${chalk.cyan('> Success!')} Alias already exists ${chalk.dim(`(${uid})`)}.`);
consterr=newError(`You are attempting to use a custom domain alias (${chalk.underline(chalk.cyan(alias))}), but this is only enabled for premium accounts. Please upgrade at ${chalk.underline('https://zeit.co/account')}`);
consterr=newError(`Custom domains are only enabled for premium accounts. Please upgrade at ${chalk.underline('https://zeit.co/account')}.`);
err.userError=true;
returnbail(err);
}
if('alias_in_use'===code){
consterr=newError(`The alias you are trying to configure (${chalk.underline(chalk.cyan(alias))}) is already in use by a different account.`);
consterr=newError(`The alias you are trying to configure (${chalk.underline(chalk.bold(alias))}) is already in use by a different account.`);
err.userError=true;
returnbail(err);
}
@ -138,7 +151,6 @@ export default class Alias extends Now {
if('cert_missing'===code){
console.log(`> Provisioning certificate for ${chalk.underline(chalk.cyan(alias))}`);
awaitthis.verifyOwnership();
awaitthis.createCert();
// try again, but now having provisioned the certificate
@ -152,10 +164,12 @@ export default class Alias extends Now {
if(200!==res.status&&304!==res.status){
thrownewError('Unhandled error');
}
returnbody;
});
}
asyncverifyOwnership(domain){
verifyOwnership(domain){
returnthis.retry(async(bail,attempt)=>{
consttargets=awaitresolve4('alias.zeit.co');
@ -172,7 +186,7 @@ export default class Alias extends Now {
for(constipofips){
if(!~targets.indexOf(ip)){
consterr=newError(`The domain ${domain} has an A record ${chalk.bold(ip)} that doesn\'t resolve to ${chalk.bold('alias.zeit.co')}. Make sure the appropriate \`ALIAS\` or \`CNAME\` records are configured.`);
consterr=newError(`The domain ${domain} has an A record ${chalk.bold(ip)} that doesn\'t resolve to ${chalk.bold(chalk.underline('alias.zeit.co'))}. Please check your DNS settings.`);
err.userError=true;
returnbail(err);
}
@ -180,7 +194,7 @@ export default class Alias extends Now {