초기 PM 소스 전체 업로드
This commit is contained in:
29
config/onPremiseClient.js
Normal file
29
config/onPremiseClient.js
Normal file
@@ -0,0 +1,29 @@
|
||||
const { S3Client } = require('@aws-sdk/client-s3');
|
||||
require('dotenv').config();
|
||||
|
||||
// minIO
|
||||
const onPremiseClient = new S3Client({
|
||||
region: 'auto',
|
||||
endpoint: process.env.MINIO_ENDPOINT,
|
||||
forcePathStyle: true, // 중요! MinIO는 path-style 요청을 기본으로 사용
|
||||
credentials: {
|
||||
accessKeyId: process.env.MINIO_ACCESSKEYID,
|
||||
secretAccessKey: process.env.MINIO_SECRETACCESSKEY,
|
||||
},
|
||||
});
|
||||
|
||||
// 로컬 MinIO는 대문자 버킷명을 허용하지 않으므로, 모든 S3 요청의 Bucket 파라미터를 소문자로 변환하는 미들웨어 주입
|
||||
onPremiseClient.middlewareStack.add(
|
||||
(next, context) => async (args) => {
|
||||
if (args.input && args.input.Bucket) {
|
||||
args.input.Bucket = args.input.Bucket.toLowerCase().replaceAll('_', '-');
|
||||
}
|
||||
return next(args);
|
||||
},
|
||||
{
|
||||
step: 'initialize',
|
||||
name: 'lowercaseBucketName'
|
||||
}
|
||||
);
|
||||
|
||||
module.exports = onPremiseClient;
|
||||
Reference in New Issue
Block a user