Skip to content

Commit

Permalink
DO-1531: retain variable names and ordering
Browse files Browse the repository at this point in the history
  • Loading branch information
gowrizrh committed Sep 26, 2023
1 parent ffd2187 commit 6b299d0
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions packages/static-hosting/lib/static-hosting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,10 @@ export class StaticHosting extends Construct {
const enforceSSL = props.enforceSSL !== false;
const disableCSP = props.disableCSP === true;

const domainNames: Array<string> = props.extraDistributionCnames
? siteNameArray.concat(props.extraDistributionCnames)
: siteNameArray;

const s3LoggingBucket = props.enableS3AccessLogging
? new Bucket(this, "S3LoggingBucket", {
bucketName: `${siteName}-s3-access-logs`,
Expand Down Expand Up @@ -271,10 +275,6 @@ export class StaticHosting extends Construct {
}
}

const domainNames: Array<string> = props.extraDistributionCnames
? siteNameArray.concat(props.extraDistributionCnames)
: siteNameArray;

const distributionProps: DistributionProps = {
domainNames: domainNames,
webAclId: props.webAclArn,
Expand All @@ -283,7 +283,9 @@ export class StaticHosting extends Construct {
sslSupportMethod: SSLMethod.SNI,
priceClass: PriceClass.PRICE_CLASS_ALL,
enableLogging: props.enableCloudFrontAccessLogging,
logBucket: props.enableCloudFrontAccessLogging ? bucket : undefined,
logBucket: props.enableCloudFrontAccessLogging
? loggingBucket
: undefined,
minimumProtocolVersion: SecurityPolicyProtocol.TLS_V1_2_2018,
certificate: Certificate.fromCertificateArn(
this,
Expand Down Expand Up @@ -315,10 +317,14 @@ export class StaticHosting extends Construct {
],
});

new Policy(this, "CloudFrontInvalidationPolicy", {
groups: [publisherGroup],
statements: [cloudFrontInvalidationPolicyStatement],
});
const cloudFrontInvalidationPolicy = new Policy(
this,
"CloudFrontInvalidationPolicy",
{
groups: [publisherGroup],
statements: [cloudFrontInvalidationPolicyStatement],
}
);
}
new CfnOutput(this, "DistributionId", {
description: "DistributionId",
Expand Down

0 comments on commit 6b299d0

Please sign in to comment.