Add force path style config for s3 - fixes #62 (#65)

This commit is contained in:
Hakan Shehu
2025-06-15 11:39:35 +02:00
committed by GitHub
parent f454856ea4
commit b711af0431
3 changed files with 4 additions and 0 deletions

View File

@@ -9,4 +9,5 @@ export const s3Client = new S3Client({
accessKeyId: config.storage.accessKey, accessKeyId: config.storage.accessKey,
secretAccessKey: config.storage.secretKey, secretAccessKey: config.storage.secretKey,
}, },
forcePathStyle: config.storage.forcePathStyle,
}); });

View File

@@ -7,6 +7,7 @@ export const storageConfigSchema = z.object({
secretKey: z.string({ error: 'STORAGE_S3_SECRET_KEY is required' }), secretKey: z.string({ error: 'STORAGE_S3_SECRET_KEY is required' }),
bucket: z.string({ error: 'STORAGE_S3_BUCKET is required' }), bucket: z.string({ error: 'STORAGE_S3_BUCKET is required' }),
region: z.string({ error: 'STORAGE_S3_REGION is required' }), region: z.string({ error: 'STORAGE_S3_REGION is required' }),
forcePathStyle: z.boolean().optional(),
}); });
export type StorageConfig = z.infer<typeof storageConfigSchema>; export type StorageConfig = z.infer<typeof storageConfigSchema>;
@@ -19,5 +20,6 @@ export const readStorageConfigVariables = () => {
secretKey: process.env.STORAGE_S3_SECRET_KEY, secretKey: process.env.STORAGE_S3_SECRET_KEY,
bucket: process.env.STORAGE_S3_BUCKET, bucket: process.env.STORAGE_S3_BUCKET,
region: process.env.STORAGE_S3_REGION, region: process.env.STORAGE_S3_REGION,
forcePathStyle: process.env.STORAGE_S3_FORCE_PATH_STYLE === 'true',
}; };
}; };

View File

@@ -150,6 +150,7 @@ services:
STORAGE_S3_SECRET_KEY: 'your_minio_password' STORAGE_S3_SECRET_KEY: 'your_minio_password'
STORAGE_S3_BUCKET: 'colanode-avatars' STORAGE_S3_BUCKET: 'colanode-avatars'
STORAGE_S3_REGION: 'us-east-1' STORAGE_S3_REGION: 'us-east-1'
STORAGE_S3_FORCE_PATH_STYLE: 'true'
# ─────────────────────────────────────────────────────────────── # ───────────────────────────────────────────────────────────────
# SMTP configuration # SMTP configuration