serverless-appsync-cloudfront
Advanced tools
Comparing version 1.0.1 to 1.0.2
34
index.js
@@ -13,3 +13,2 @@ const path = require("path"); | ||
this.options = options; | ||
this.givenDomainName = this.getConfig("domainName", null); | ||
@@ -64,3 +63,3 @@ this.hooks = { | ||
const cnameDomain = this.getConfig("domainName", null); | ||
const cnameDomain = this.getConfig("domainName"); | ||
this.serverless.cli.consoleLog(chalk.yellow("CloudFront domain name")); | ||
@@ -78,3 +77,6 @@ this.serverless.cli.consoleLog( | ||
this.changeResourceRecordSet("UPSERT", apiDistributionDomain.OutputValue); | ||
await this.changeResourceRecordSet( | ||
"UPSERT", | ||
apiDistributionDomain.OutputValue | ||
); | ||
} | ||
@@ -88,4 +90,4 @@ } | ||
let certificateArn; // The arn of the choosen certificate | ||
let certificateName = this.getConfig("certificateName", null); | ||
if (!certificateName && !this.givenDomainName) return; | ||
let certificateName = this.getConfig("certificateName"); | ||
if (!certificateName && !this.getConfig("domainName")) return; | ||
try { | ||
@@ -109,3 +111,3 @@ const certData = await this.acm | ||
} else { | ||
certificateName = this.givenDomainName; | ||
certificateName = this.getConfig("domainName"); | ||
certificates.forEach((certificate) => { | ||
@@ -150,3 +152,3 @@ let certificateListName = certificate.DomainName; | ||
const createRoute53Record = this.getConfig("createRoute53Record", null); | ||
const createRoute53Record = this.getConfig("createRoute53Record"); | ||
if (createRoute53Record !== undefined && createRoute53Record === false) { | ||
@@ -166,3 +168,3 @@ this.serverless.cli.log("Skipping creation of Route53 record."); | ||
}, | ||
Name: this.givenDomainName, | ||
Name: this.getConfig("domainName"), | ||
Type, | ||
@@ -183,3 +185,5 @@ }, | ||
throw new Error( | ||
`Error: Failed to ${action} A Alias for ${this.givenDomainName}\n` | ||
`Error: Failed to ${action} A Alias for ${this.getConfig( | ||
"domainName" | ||
)}\n` | ||
); | ||
@@ -256,3 +260,3 @@ } | ||
throw new Error( | ||
`Error: Could not find hosted zone "${this.givenDomainName}"` | ||
`Error: Could not find hosted zone "${this.getConfig("domainName")}"` | ||
); | ||
@@ -279,3 +283,3 @@ } | ||
prepareLogging(distributionConfig) { | ||
const loggingBucket = this.getConfig("logging.bucket", null); | ||
const loggingBucket = this.getConfig("logging.bucket"); | ||
@@ -291,3 +295,3 @@ if (loggingBucket !== null) { | ||
prepareDomain(distributionConfig) { | ||
const domain = this.getConfig("domainName", null); | ||
const domain = this.getConfig("domainName"); | ||
if (domain !== null) { | ||
@@ -351,3 +355,3 @@ distributionConfig.Aliases = Array.isArray(domain) ? domain : [domain]; | ||
const certificate = | ||
this.getConfig("certificate", null) || (await this.getCertArn()); | ||
this.getConfig("certificate") || (await this.getCertArn()); | ||
if (certificate) { | ||
@@ -363,3 +367,3 @@ distributionConfig.ViewerCertificate.AcmCertificateArn = certificate; | ||
prepareWaf(distributionConfig) { | ||
const waf = this.getConfig("waf", null); | ||
const waf = this.getConfig("waf"); | ||
@@ -389,3 +393,3 @@ if (waf !== null) { | ||
getConfig(field, defaultValue) { | ||
getConfig(field, defaultValue = null) { | ||
return _.get( | ||
@@ -392,0 +396,0 @@ this.serverless, |
{ | ||
"name": "serverless-appsync-cloudfront", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"engines": { | ||
@@ -5,0 +5,0 @@ "node": ">=8.10" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
349
21440