From c810d0b314ca842904a30bfee7825214e10e3a15 Mon Sep 17 00:00:00 2001 From: sidnelui-krystal <126042423+sidnelui-krystal@users.noreply.github.com> Date: Tue, 20 Aug 2024 20:05:59 +0800 Subject: [PATCH] fix: added env variable for support for forcepathstyle on s3 (#181) --- .env.example | 1 + .../src/integrations/environment/environment.service.ts | 4 ++++ .../src/integrations/storage/providers/storage.provider.ts | 1 + 3 files changed, 6 insertions(+) diff --git a/.env.example b/.env.example index a52f48f2..024104ea 100644 --- a/.env.example +++ b/.env.example @@ -19,6 +19,7 @@ AWS_S3_SECRET_ACCESS_KEY= AWS_S3_REGION= AWS_S3_BUCKET= AWS_S3_ENDPOINT= +AWS_S3_FORCE_PATH_STYLE= # options: smtp | postmark MAIL_DRIVER=smtp diff --git a/apps/server/src/integrations/environment/environment.service.ts b/apps/server/src/integrations/environment/environment.service.ts index 3d3a7dbb..dbc39353 100644 --- a/apps/server/src/integrations/environment/environment.service.ts +++ b/apps/server/src/integrations/environment/environment.service.ts @@ -62,6 +62,10 @@ export class EnvironmentService { getAwsS3Endpoint(): string { return this.configService.get('AWS_S3_ENDPOINT'); } + + getAwsS3ForcePathStyle(): boolean { + return this.configService.get('AWS_S3_FORCE_PATH_STYLE') + } getAwsS3Url(): string { return this.configService.get('AWS_S3_URL'); diff --git a/apps/server/src/integrations/storage/providers/storage.provider.ts b/apps/server/src/integrations/storage/providers/storage.provider.ts index c23d9a4b..791bf694 100644 --- a/apps/server/src/integrations/storage/providers/storage.provider.ts +++ b/apps/server/src/integrations/storage/providers/storage.provider.ts @@ -48,6 +48,7 @@ export const storageDriverConfigProvider = { endpoint: environmentService.getAwsS3Endpoint(), bucket: environmentService.getAwsS3Bucket(), baseUrl: environmentService.getAwsS3Url(), + forcePathStyle: environmentService.getAwsS3ForcePathStyle(), credentials: undefined, }, };