Skip to content

Commit

Permalink
fix: cdn url logging and upload url fix
Browse files Browse the repository at this point in the history
  • Loading branch information
cazala committed Dec 23, 2024
1 parent c1e30a5 commit d486053
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/modules/s3/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ export async function createS3Component(components: {
const endpoint = await config.getString('AWS_S3_ENDPOINT')
const cdnUrl = await config.getString('CDN_URL')

if (cdnUrl) {
console.log('CDN URL provided', cdnUrl)
} else {
console.log('No CDN URL provided')
}

if (!bucketName) {
componentLogger.warn(
'Missing AWS bucket - S3 component will use stub implementation'
Expand Down Expand Up @@ -89,7 +95,9 @@ export async function createS3Component(components: {
})
)

const fileUrl = endpoint
const fileUrl = cdnUrl
? `${cdnUrl}/${key}`
: endpoint
? `${endpoint}/${bucketName}/${key}`
: `https://${bucketName}.s3.amazonaws.com/${key}`

Expand Down

0 comments on commit d486053

Please sign in to comment.