Skip to content

Commit d486053

Browse files
committed
fix: cdn url logging and upload url fix
1 parent c1e30a5 commit d486053

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/modules/s3/component.ts

+9-1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ export async function createS3Component(components: {
3636
const endpoint = await config.getString('AWS_S3_ENDPOINT')
3737
const cdnUrl = await config.getString('CDN_URL')
3838

39+
if (cdnUrl) {
40+
console.log('CDN URL provided', cdnUrl)
41+
} else {
42+
console.log('No CDN URL provided')
43+
}
44+
3945
if (!bucketName) {
4046
componentLogger.warn(
4147
'Missing AWS bucket - S3 component will use stub implementation'
@@ -89,7 +95,9 @@ export async function createS3Component(components: {
8995
})
9096
)
9197

92-
const fileUrl = endpoint
98+
const fileUrl = cdnUrl
99+
? `${cdnUrl}/${key}`
100+
: endpoint
93101
? `${endpoint}/${bucketName}/${key}`
94102
: `https://${bucketName}.s3.amazonaws.com/${key}`
95103

0 commit comments

Comments
 (0)