fix: adicionar region e logs no MinIO client
This commit is contained in:
@@ -1,12 +1,18 @@
|
|||||||
import * as Minio from 'minio';
|
import * as Minio from 'minio';
|
||||||
|
|
||||||
|
const endpoint = process.env.MINIO_ENDPOINT || 'localhost';
|
||||||
|
const port = parseInt(process.env.MINIO_PORT || '9000');
|
||||||
|
const useSSL = process.env.MINIO_USE_SSL === 'true';
|
||||||
|
|
||||||
|
console.log(`[MinIO] Configurando cliente: ${endpoint}:${port} (SSL: ${useSSL})`);
|
||||||
|
|
||||||
export const minioClient = new Minio.Client({
|
export const minioClient = new Minio.Client({
|
||||||
endPoint: process.env.MINIO_ENDPOINT || 'localhost',
|
endPoint: endpoint,
|
||||||
port: parseInt(process.env.MINIO_PORT || '9000'),
|
port: port,
|
||||||
useSSL: process.env.MINIO_USE_SSL === 'true',
|
useSSL: useSSL,
|
||||||
accessKey: process.env.MINIO_ACCESS_KEY || 'admin',
|
accessKey: process.env.MINIO_ACCESS_KEY || 'admin',
|
||||||
secretKey: process.env.MINIO_SECRET_KEY || 'adminpassword',
|
secretKey: process.env.MINIO_SECRET_KEY || 'adminpassword',
|
||||||
pathStyle: true, // Força path-style URLs (endpoint/bucket ao invés de bucket.endpoint)
|
region: 'us-east-1', // Força região para evitar lookup
|
||||||
});
|
});
|
||||||
|
|
||||||
export const bucketName = process.env.MINIO_BUCKET_NAME || 'occto-images';
|
export const bucketName = process.env.MINIO_BUCKET_NAME || 'occto-images';
|
||||||
|
|||||||
Reference in New Issue
Block a user