MAX_UPLOAD_PART: bytes.parse(config.get<string>('object_storage.max_upload_part')),
ENDPOINT: config.get<string>('object_storage.endpoint'),
REGION: config.get<string>('object_storage.region'),
+ UPLOAD_ACL: config.get<string>('object_storage.upload_acl'),
CREDENTIALS: {
ACCESS_KEY_ID: config.get<string>('object_storage.credentials.access_key_id'),
SECRET_ACCESS_KEY: config.get<string>('object_storage.credentials.secret_access_key')
CompletedPart,
CompleteMultipartUploadCommand,
CreateMultipartUploadCommand,
+ CreateMultipartUploadCommandInput,
DeleteObjectCommand,
GetObjectCommand,
ListObjectsV2Command,
PutObjectCommand,
+ PutObjectCommandInput,
UploadPartCommand
} from '@aws-sdk/client-s3'
import { pipelinePromise } from '@server/helpers/core-utils'
}) {
const { objectStorageKey, content, bucketInfo } = options
- const command = new PutObjectCommand({
+ const input: PutObjectCommandInput = {
Bucket: bucketInfo.BUCKET_NAME,
Key: buildKey(objectStorageKey, bucketInfo),
- Body: content,
- ACL: 'public-read'
- })
+ Body: content
+ }
+
+ if (CONFIG.OBJECT_STORAGE.UPLOAD_ACL) {
+ input.ACL = CONFIG.OBJECT_STORAGE.UPLOAD_ACL
+ }
+
+ const command = new PutObjectCommand(input)
await getClient().send(command)
const statResult = await stat(inputPath)
- const createMultipartCommand = new CreateMultipartUploadCommand({
+ const input: CreateMultipartUploadCommandInput = {
Bucket: bucketInfo.BUCKET_NAME,
- Key: key,
- ACL: 'public-read'
- })
+ Key: buildKey(objectStorageKey, bucketInfo)
+ }
+
+ if (CONFIG.OBJECT_STORAGE.UPLOAD_ACL) {
+ input.ACL = CONFIG.OBJECT_STORAGE.UPLOAD_ACL
+ }
+
+ const createMultipartCommand = new CreateMultipartUploadCommand(input)
const createResponse = await s3Client.send(createMultipartCommand)
const fd = await open(inputPath, 'r')