초기 PM 소스 전체 업로드
This commit is contained in:
14
config/cloudClient.js
Normal file
14
config/cloudClient.js
Normal file
@@ -0,0 +1,14 @@
|
||||
const { S3Client } = require('@aws-sdk/client-s3');
|
||||
require('dotenv').config();
|
||||
|
||||
// CloudFlare R2
|
||||
const cloudClient = new S3Client({
|
||||
region: 'auto',
|
||||
endpoint: process.env.R2_ENDPOINT,
|
||||
credentials: {
|
||||
accessKeyId: process.env.R2_ACCESSKEYID,
|
||||
secretAccessKey: process.env.R2_SECRETACCESSKEY,
|
||||
},
|
||||
});
|
||||
|
||||
module.exports = cloudClient;
|
||||
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;
|
||||
18
config/redis.js
Normal file
18
config/redis.js
Normal file
@@ -0,0 +1,18 @@
|
||||
const Redis = require('ioredis');
|
||||
require('dotenv').config();
|
||||
|
||||
const redisConnection = new Redis({
|
||||
host: process.env.REDIS_HOST,
|
||||
port: +process.env.REDIS_PORT,
|
||||
maxRetriesPerRequest: null,
|
||||
password: process.env.REDIS_PASSWORD
|
||||
// tls:{
|
||||
// }
|
||||
});
|
||||
|
||||
// await redisConnection.del('bull:convert-pdf:id');
|
||||
|
||||
redisConnection.on('connect', () => console.log('✔️ Redis connected'));
|
||||
redisConnection.on('error', (err) => console.error('❌ Redis error', err));
|
||||
|
||||
module.exports = { redisConnection };
|
||||
Reference in New Issue
Block a user