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 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 +}