[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:
parent
bde9e543d4
commit
641df313d4
|
|
@ -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({
|
||||
|
|
|
|||
Loading…
Reference in New Issue