[Fix] Change S3 logger to accept more authorization methods for AWS (#4114)

* Change S3 logger to accept more authorization methods for AWS

* Lint fix
This commit is contained in:
Daniel D'Abate 2025-03-11 18:29:34 +01:00 committed by GitHub
parent bde9e543d4
commit 641df313d4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 13 additions and 4 deletions

View File

@ -21,14 +21,23 @@ if (process.env.STORAGE_TYPE === 's3') {
const customURL = process.env.S3_ENDPOINT_URL
const forcePathStyle = process.env.S3_FORCE_PATH_STYLE === 'true'
if (!region || !s3Bucket) {
throw new Error('S3 storage configuration is missing')
}
let credentials: S3ClientConfig['credentials'] | undefined
if (accessKeyId && secretAccessKey) {
credentials = {
accessKeyId,
secretAccessKey
}
}
const s3Config: S3ClientConfig = {
region: region,
endpoint: customURL,
forcePathStyle: forcePathStyle,
credentials: {
accessKeyId: accessKeyId as string,
secretAccessKey: secretAccessKey as string
}
credentials: credentials
}
s3ServerStream = new S3StreamLogger({