* Get the S3 endpoint URL based on configuration * Constructs the endpoint from account ID if not explicitly provided * @returns The S3 endpoint URL string
()
| 45 | * @returns The S3 endpoint URL string |
| 46 | */ |
| 47 | private getEndpoint(): string { |
| 48 | const s3Config = this.configService.s3Config; |
| 49 | |
| 50 | // Use explicit endpoint if provided |
| 51 | if (s3Config.endpoint) { |
| 52 | return s3Config.endpoint; |
| 53 | } |
| 54 | |
| 55 | // Construct endpoint from account ID for Cloudflare R2 |
| 56 | if (s3Config.accountId) { |
| 57 | return `https://${s3Config.accountId}.r2.cloudflarestorage.com`; |
| 58 | } |
| 59 | |
| 60 | // Fallback to default Cloudflare endpoint (should not reach here if hasS3Configured is properly checked) |
| 61 | return 'https://r2.cloudflarestorage.com'; |
| 62 | } |
| 63 | |
| 64 | /** |
| 65 | * Upload a file to either S3/Cloudflare R2 or local storage based on configuration |
no outgoing calls
no test coverage detected