@serverless/domain
Advanced tools
Comparing version 2.0.6 to 2.0.7
{ | ||
"name": "@serverless/domain", | ||
"version": "2.0.6", | ||
"version": "2.0.7", | ||
"main": "./serverless.js", | ||
@@ -5,0 +5,0 @@ "publishConfig": { |
@@ -16,4 +16,4 @@ # Domain | ||
domain: mywebsite.com | ||
dns: | ||
$: ${websiteComponentInstance} | ||
subdomains: | ||
www: ${websiteComponentInstance} | ||
api: ${backendComponentInstance} | ||
@@ -20,0 +20,0 @@ admin: ${anotherWebsiteComponentInstance} |
@@ -33,2 +33,3 @@ const { Component } = require('@serverless/core') | ||
inputs.region = inputs.region || 'us-east-1' | ||
if (!inputs.domain) { | ||
@@ -46,2 +47,3 @@ throw Error(`"domain" is a required input.`) | ||
const subdomains = prepareSubdomains(inputs) | ||
this.state.region = inputs.region | ||
this.state.domain = inputs.domain | ||
@@ -169,3 +171,3 @@ this.state.subdomains = subdomains | ||
// Get AWS SDK Clients | ||
const clients = getClients(this.context.credentials.aws) | ||
const clients = getClients(this.context.credentials.aws, this.state.region) | ||
@@ -192,6 +194,6 @@ this.context.debug(`Getting the Hosted Zone ID for the domain ${this.state.domain}.`) | ||
if (domainState.domain.startsWith('wwww')) { | ||
if (domainState.domain.startsWith('www')) { | ||
await removeWebsiteDomainDnsRecords( | ||
clients.route53, | ||
domainState.domain.repalce('www.', ''), // it'll move on if it doesn't exist | ||
domainState.domain.replace('www.', ''), // it'll move on if it doesn't exist | ||
domainHostedZoneId, | ||
@@ -198,0 +200,0 @@ distribution.url |
14
utils.js
@@ -75,6 +75,14 @@ const aws = require('aws-sdk') | ||
for (const domain of Object.keys(state.dns)) { | ||
if (!inputs.dns[domain]) { | ||
const outdatedDomains = { | ||
domain: state.domain, | ||
subdomains: [] | ||
} | ||
for (const domain of state.subdomains) { | ||
if (!inputs.subdomains[domain.domain]) { | ||
outdatedDomains.push(domain) | ||
} | ||
} | ||
return outdatedDomains | ||
} | ||
@@ -728,2 +736,3 @@ | ||
} | ||
/** | ||
@@ -736,2 +745,3 @@ * Exports | ||
prepareSubdomains, | ||
getOutdatedDomains, | ||
describeCertificateByArn, | ||
@@ -738,0 +748,0 @@ getCertificateArnByDomain, |
45039
940