feat(s3): add S3_SKIP_POLICY env variable to disable setBucketPolicy for incompatible providers

This commit is contained in:
deyvi-dev 2025-04-07 20:23:33 -03:00
parent 427c994993
commit 1d2e029b54
2 changed files with 5 additions and 3 deletions

View File

@ -63,9 +63,9 @@ const createBucket = async () => {
if (!exists) { if (!exists) {
await minioClient.makeBucket(bucketName); await minioClient.makeBucket(bucketName);
} }
if (!BUCKET.SKIP_POLICY) {
await setBucketPolicy(); await setBucketPolicy();
}
logger.info(`S3 Bucket ${bucketName} - ON`); logger.info(`S3 Bucket ${bucketName} - ON`);
return true; return true;
} catch (error) { } catch (error) {

View File

@ -251,6 +251,7 @@ export type S3 = {
PORT?: number; PORT?: number;
USE_SSL?: boolean; USE_SSL?: boolean;
REGION?: string; REGION?: string;
SKIP_POLICY?: boolean;
}; };
export type CacheConf = { REDIS: CacheConfRedis; LOCAL: CacheConfLocal }; export type CacheConf = { REDIS: CacheConfRedis; LOCAL: CacheConfLocal };
@ -555,6 +556,7 @@ export class ConfigService {
PORT: Number.parseInt(process.env?.S3_PORT || '9000'), PORT: Number.parseInt(process.env?.S3_PORT || '9000'),
USE_SSL: process.env?.S3_USE_SSL === 'true', USE_SSL: process.env?.S3_USE_SSL === 'true',
REGION: process.env?.S3_REGION, REGION: process.env?.S3_REGION,
SKIP_POLICY: process.env?.S3_SKIP_POLICY === 'true',
}, },
AUTHENTICATION: { AUTHENTICATION: {
API_KEY: { API_KEY: {