(private configService: AppConfigService)
| 19 | private readonly mediaDir: string; |
| 20 | |
| 21 | constructor(private configService: AppConfigService) { |
| 22 | // Initialize S3 client if configurations are available |
| 23 | if (this.configService.hasS3Configured) { |
| 24 | const s3Config = this.configService.s3Config; |
| 25 | this.s3Client = new S3Client({ |
| 26 | region: s3Config.region, |
| 27 | endpoint: this.getEndpoint(), |
| 28 | credentials: { |
| 29 | accessKeyId: s3Config.accessKeyId, |
| 30 | secretAccessKey: s3Config.secretAccessKey, |
| 31 | }, |
| 32 | }); |
| 33 | } |
| 34 | |
| 35 | // Initialize media directory for local storage |
| 36 | this.mediaDir = path.join(getRootDir(), 'media'); |
| 37 | if (!existsSync(this.mediaDir)) { |
| 38 | mkdirSync(this.mediaDir, { recursive: true }); |
| 39 | } |
| 40 | } |
| 41 | |
| 42 | /** |
| 43 | * Get the S3 endpoint URL based on configuration |
nothing calls this directly
no test coverage detected