From 1625ca7c157b3c5833c5ba1eaba7854728377841 Mon Sep 17 00:00:00 2001 From: peppelauro Date: Thu, 25 Jul 2024 16:39:01 +0200 Subject: [PATCH 1/2] Update .env.server.example --- template/app/.env.server.example | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/template/app/.env.server.example b/template/app/.env.server.example index 59d8d17e..7c75b777 100644 --- a/template/app/.env.server.example +++ b/template/app/.env.server.example @@ -39,7 +39,8 @@ GOOGLE_ANALYTICS_PRIVATE_KEY=LS02... GOOGLE_ANALYTICS_PROPERTY_ID=123456789 # (OPTIONAL) get your aws s3 credentials at https://console.aws.amazon.com and create a new IAM user with S3 access +AWS_S3_ENDPOINT_URL=https://... AWS_S3_IAM_ACCESS_KEY=ACK... AWS_S3_IAM_SECRET_KEY=t+33a... AWS_S3_FILES_BUCKET=your-bucket-name -AWS_S3_REGION=your-region \ No newline at end of file +AWS_S3_REGION=your-region From 8b859fb128917052561d74378059f603997418e6 Mon Sep 17 00:00:00 2001 From: peppelauro Date: Thu, 25 Jul 2024 16:41:40 +0200 Subject: [PATCH 2/2] Update s3Utils.ts Add endpoint param to the call to enable custom endpoint --- template/app/src/file-upload/s3Utils.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/template/app/src/file-upload/s3Utils.ts b/template/app/src/file-upload/s3Utils.ts index 24806492..5e30d213 100644 --- a/template/app/src/file-upload/s3Utils.ts +++ b/template/app/src/file-upload/s3Utils.ts @@ -4,6 +4,7 @@ import { GetObjectCommand, PutObjectCommand } from '@aws-sdk/client-s3'; import { getSignedUrl } from '@aws-sdk/s3-request-presigner'; const s3Client = new S3Client({ + endpoint: process.env.AWS_S3_ENDPOINT_URL, region: process.env.AWS_S3_REGION, credentials: { accessKeyId: process.env.AWS_S3_IAM_ACCESS_KEY!, @@ -36,4 +37,4 @@ export const getDownloadFileSignedURLFromS3 = async ({ key }: { key: string }) = }; const command = new GetObjectCommand(s3Params); return await getSignedUrl(s3Client, command, { expiresIn: 3600 }); -} \ No newline at end of file +}