Skip to content

Commit

Permalink
Make bucket var a readonly property
Browse files Browse the repository at this point in the history
  • Loading branch information
TheOrangePuff committed Jul 27, 2022
1 parent 8f8ed4c commit 0dfa6ae
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/prerender-fargate/lib/prerender-fargate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,13 @@ export interface PrerenderOptions {
}

export class PrerenderFargate extends Construct {
readonly bucket: Bucket;

constructor(scope: Construct, id: string, props: PrerenderOptions) {
super(scope, id);

// Create bucket for prerender storage
const bucket = new Bucket(this, `${props.prerenderName}-bucket`, {
this.bucket = new Bucket(this, `${props.prerenderName}-bucket`, {
bucketName: props.bucketName,
lifecycleRules: [{
enabled: true,
Expand All @@ -42,7 +44,7 @@ export class PrerenderFargate extends Construct {

// Configure access to the bucket for the container
const user = new User(this, 'PrerenderAccess');
bucket.grantReadWrite(user);
this.bucket.grantReadWrite(user);

const accessKey = new AccessKey(this, 'PrerenderAccessKey', {
user: user,
Expand Down Expand Up @@ -73,7 +75,7 @@ export class PrerenderFargate extends Construct {
enableLogging: true,
containerPort: 3000,
environment: {
S3_BUCKET_NAME: bucket.bucketName,
S3_BUCKET_NAME: this.bucket.bucketName,
AWS_ACCESS_KEY_ID: accessKey.accessKeyId,
AWS_SECRET_ACCESS_KEY: accessKey.secretAccessKey.toString(),
AWS_REGION: Stack.of(this).region,
Expand Down

0 comments on commit 0dfa6ae

Please sign in to comment.