| 1 | import { createZodDto } from '@yikart/common' |
| 2 | import { z } from 'zod' |
| 3 | |
| 4 | export const s3ConfigSchema = z.object({ |
| 5 | region: z.string(), |
| 6 | accessKeyId: z.string().optional(), |
| 7 | secretAccessKey: z.string().optional(), |
| 8 | bucketName: z.string(), |
| 9 | endpoint: z.url(), |
| 10 | cdnEndpoint: z.url().optional(), |
| 11 | signExpires: z.number().default(5 * 60).describe('sign expires in seconds'), |
| 12 | forcePathStyle: z.boolean().default(false).describe('使用 path-style 访问,本地 S3 兼容服务需要开启'), |
| 13 | publicEndpoint: z.url().optional().describe('客户端可访问的公网 endpoint,用于生成 presigned URL;不设置时使用 endpoint'), |
| 14 | }) |
| 15 | |
| 16 | export class S3Config extends createZodDto(s3ConfigSchema) {} |
| 17 |