mirror of
https://github.com/Afilmory/afilmory
synced 2026-02-01 22:48:17 +00:00
feat: add maxFileLimit configuration for S3 storage
- Introduced maxFileLimit property in builder.config.ts and S3Config interface to allow dynamic control of the maximum number of files retrieved from S3. - Updated S3StorageProvider to utilize maxFileLimit for fetching objects, enhancing flexibility in file management. Signed-off-by: Innei <tukon479@gmail.com>
This commit is contained in:
@@ -86,6 +86,7 @@ export const defaultBuilderConfig: BuilderConfig = {
|
||||
prefix: env.S3_PREFIX,
|
||||
customDomain: env.S3_CUSTOM_DOMAIN,
|
||||
excludeRegex: env.S3_EXCLUDE_REGEX,
|
||||
maxFileLimit: 1000,
|
||||
},
|
||||
|
||||
options: {
|
||||
|
||||
@@ -55,6 +55,7 @@ export type S3Config = {
|
||||
prefix?: string
|
||||
customDomain?: string
|
||||
excludeRegex?: string
|
||||
maxFileLimit?: number
|
||||
}
|
||||
|
||||
export type GitHubConfig = {
|
||||
|
||||
@@ -84,7 +84,7 @@ export class S3StorageProvider implements StorageProvider {
|
||||
const listCommand = new ListObjectsV2Command({
|
||||
Bucket: this.config.bucket,
|
||||
Prefix: this.config.prefix,
|
||||
MaxKeys: 1000, // 最多获取 1000 张照片
|
||||
MaxKeys: this.config.maxFileLimit, // 最多获取 1000 张照片
|
||||
})
|
||||
|
||||
const listResponse = await s3Client.send(listCommand)
|
||||
@@ -111,7 +111,7 @@ export class S3StorageProvider implements StorageProvider {
|
||||
const listCommand = new ListObjectsV2Command({
|
||||
Bucket: this.config.bucket,
|
||||
Prefix: this.config.prefix,
|
||||
MaxKeys: 1000,
|
||||
MaxKeys: this.config.maxFileLimit,
|
||||
})
|
||||
|
||||
const listResponse = await s3Client.send(listCommand)
|
||||
|
||||
Reference in New Issue
Block a user