feat: add IRSA support for S3 authentication (#265)

This commit is contained in:
Owais Rizvi
2025-12-02 00:54:58 +05:00
committed by GitHub
parent 915877b8e6
commit 06ca6e38b3
6 changed files with 29 additions and 113 deletions

View File

@@ -6,14 +6,19 @@ import {
import { getSignedUrl } from "@aws-sdk/s3-request-presigner";
export function createS3Client() {
const credentials =
process.env.S3_ACCESS_KEY_ID && process.env.S3_SECRET_ACCESS_KEY
? {
accessKeyId: process.env.S3_ACCESS_KEY_ID,
secretAccessKey: process.env.S3_SECRET_ACCESS_KEY,
}
: undefined;
return new S3Client({
region: process.env.S3_REGION ?? "",
endpoint: process.env.S3_ENDPOINT ?? "",
forcePathStyle: process.env.S3_FORCE_PATH_STYLE === "true",
credentials: {
accessKeyId: process.env.S3_ACCESS_KEY_ID ?? "",
secretAccessKey: process.env.S3_SECRET_ACCESS_KEY ?? "",
},
credentials,
});
}