Added S3_FORCE_PATH_STYLE environment variable support for AWS S3 client configuration to ensure compatibility with custom S3 endpoints and path-style URLs. This change sets the forcePathStyle option based on the environment variable, defaulting to false if not provided. (#3315)

Co-authored-by: Thiago Assis <thiago.assis@go9.tech>
This commit is contained in:
thiagolealassis
2024-10-07 12:00:48 -03:00
committed by GitHub
parent 14b714824b
commit 7868c8c3a1
6 changed files with 9 additions and 1 deletions
+3 -1
View File
@@ -331,6 +331,7 @@ export const getS3Config = () => {
const region = process.env.S3_STORAGE_REGION
const Bucket = process.env.S3_STORAGE_BUCKET_NAME
const customURL = process.env.S3_ENDPOINT_URL
const forcePathStyle = process.env.S3_FORCE_PATH_STYLE === 'true' ? true : false
if (!region || !Bucket) {
throw new Error('S3 storage configuration is missing')
@@ -347,7 +348,8 @@ export const getS3Config = () => {
const s3Client = new S3Client({
credentials,
region,
endpoint: customURL
endpoint: customURL,
forcePathStyle: forcePathStyle
})
return { s3Client, Bucket }
}