Skip to content

Commit

Permalink
Merge pull request #395 from aligent/hotfix/expose-bucket
Browse files Browse the repository at this point in the history
Make bucket var a readonly property
  • Loading branch information
TheOrangePuff authored Jul 27, 2022
2 parents 8f8ed4c + 0dfa6ae commit 1300f93
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 1300f93

Please sign in to comment.