Skip to content

Commit

Permalink
fix(config): default S3 endpoint with region (#7807)
Browse files Browse the repository at this point in the history
`AWS_ENDPOINT` defaults to an S3 endpoint hard-coded to ap-southeast-1.
This affects deployment scenarios to other AWS regions, unless
`AWS_ENDPOINT` is specified to line up with `AWS_REGION`.

It can be argued that the default for `AWS_ENDPOINT` should be driven
by the specific region that FormSG is deployed to, so accordingly, at
runtime, change `loadBucketS3UrlSchema()` so that the default endpoint
for S3 buckets reflects the region where FormSG is currently deployed.
  • Loading branch information
LoneRifle authored Oct 28, 2024
1 parent f67732f commit 26a391d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/app/config/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ export const loadS3BucketUrlSchema = ({
doc: 'Endpoint for S3 buckets',
format: (val) =>
validateS3BucketUrl(val, { isDev, hasTrailingSlash: false, region }),
default: 'https://s3.ap-southeast-1.amazonaws.com', // NOTE NO TRAILING / AT THE END OF THIS URL!
default: `https://s3.${region}.amazonaws.com`, // NOTE NO TRAILING / AT THE END OF THIS URL!
env: 'AWS_ENDPOINT',
},
attachmentBucketUrl: {
Expand Down

0 comments on commit 26a391d

Please sign in to comment.