Expose forcePathStyle config option with a new AWS_FORCE_PATH_STYLE env var

This commit is contained in:
David Newman 2025-11-13 11:34:58 +10:00
parent 4186db3ce2
commit 75487ca12a

View file

@ -28,9 +28,11 @@ export const initializeS3 = (): S3Client | null => {
const endpoint = process.env.AWS_ENDPOINT_URL;
const accessKeyId = process.env.AWS_ACCESS_KEY_ID;
const secretAccessKey = process.env.AWS_SECRET_ACCESS_KEY;
const forcePathStyle = ['1', 'true', 'yes'].includes(process.env.AWS_FORCE_PATH_STYLE?.toLowerCase());
const config = {
region,
forcePathStyle: forcePathStyle, // Enable path-style addressing
// Conditionally add the endpoint if it is provided
...(endpoint ? { endpoint } : {}),
};