@serverless/domain
Advanced tools
Comparing version 2.0.9 to 2.0.10
{ | ||
"name": "@serverless/domain", | ||
"version": "2.0.9", | ||
"version": "2.0.10", | ||
"main": "./serverless.js", | ||
@@ -5,0 +5,0 @@ "publishConfig": { |
@@ -15,2 +15,3 @@ # Domain | ||
inputs: | ||
privateZone: false | ||
domain: mywebsite.com | ||
@@ -17,0 +18,0 @@ subdomains: |
@@ -33,2 +33,3 @@ const { Component } = require('@serverless/core') | ||
inputs.region = inputs.region || 'us-east-1' | ||
inputs.privateZone = inputs.privateZone || false | ||
@@ -43,3 +44,3 @@ if (!inputs.domain) { | ||
// Get AWS SDK Clients | ||
const clients = getClients(this.context.credentials.aws) | ||
const clients = getClients(this.context.credentials.aws, inputs.region) | ||
@@ -49,2 +50,3 @@ this.context.debug(`Formatting domains and identifying cloud services being used.`) | ||
this.state.region = inputs.region | ||
this.state.privateZone = JSON.parse(inputs.privateZone) | ||
this.state.domain = inputs.domain | ||
@@ -55,3 +57,7 @@ this.state.subdomains = subdomains | ||
this.context.debug(`Getting the Hosted Zone ID for the domain ${inputs.domain}.`) | ||
const domainHostedZoneId = await getDomainHostedZoneId(clients.route53, inputs.domain) | ||
const domainHostedZoneId = await getDomainHostedZoneId( | ||
clients.route53, | ||
inputs.domain, | ||
inputs.privateZone | ||
) | ||
@@ -179,3 +185,7 @@ this.context.debug( | ||
this.context.debug(`Getting the Hosted Zone ID for the domain ${this.state.domain}.`) | ||
const domainHostedZoneId = await getDomainHostedZoneId(clients.route53, this.state.domain) | ||
const domainHostedZoneId = await getDomainHostedZoneId( | ||
clients.route53, | ||
this.state.domain, | ||
this.state.privateZone | ||
) | ||
@@ -182,0 +192,0 @@ for (const subdomain in this.state.subdomains) { |
@@ -96,3 +96,3 @@ const aws = require('aws-sdk') | ||
const getDomainHostedZoneId = async (route53, domain) => { | ||
const getDomainHostedZoneId = async (route53, domain, privateZone) => { | ||
const hostedZonesRes = await route53.listHostedZonesByName().promise() | ||
@@ -102,3 +102,3 @@ | ||
// Name has a period at the end, so we're using includes rather than equals | ||
(zone) => zone.Name.includes(domain) | ||
(zone) => zone.Config.PrivateZone === privateZone && zone.Name.includes(domain) | ||
) | ||
@@ -609,2 +609,3 @@ | ||
// 5. then make our changes | ||
// todo maybe we should add ALL error codes returned from CloudFront/S3?! | ||
params.DistributionConfig.CustomErrorResponses = { | ||
@@ -665,3 +666,3 @@ Quantity: 2, | ||
Quantity: 1, | ||
Items: ['/index.html'] | ||
Items: ['/*'] | ||
} | ||
@@ -668,0 +669,0 @@ } |
46267
985
35