aboutsummaryrefslogtreecommitdiff
path: root/src/lib/minio.ts
diff options
context:
space:
mode:
authorschererleander <leander@schererleander.de>2025-12-26 18:08:53 +0100
committerschererleander <leander@schererleander.de>2025-12-26 18:08:53 +0100
commit338075af2da116d7b51fab6ee6398320f4f8141c (patch)
tree73d0d2cedac23cc1ce700f40461d8d6a5d42d304 /src/lib/minio.ts
parentad7b4f1ab0b3ef2f71e9a70078716aed50cdbf64 (diff)
fix(storage): improve minio URL construction for production
Diffstat (limited to 'src/lib/minio.ts')
-rw-r--r--src/lib/minio.ts6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/lib/minio.ts b/src/lib/minio.ts
index 030ae05..f92f4ed 100644
--- a/src/lib/minio.ts
+++ b/src/lib/minio.ts
@@ -24,7 +24,11 @@ export async function uploadToMinio(
'Cache-Control': 'max-age=31536000', // 1 year cache
})
- const url = `${process.env.MINIO_ENDPOINT ? `http://${process.env.MINIO_ENDPOINT}:9000` : 'http://localhost:9000'}/${BUCKET_NAME}/${key}`
+ // Construct URL using the same configuration as the client
+ const protocol = process.env.NODE_ENV === 'production' ? 'https' : 'http'
+ const host = process.env.MINIO_ENDPOINT_HOST || 'localhost'
+ const port = process.env.MINIO_ENDPOINT_PORT || '9000'
+ const url = `${protocol}://${host}:${port}/${BUCKET_NAME}/${key}`
return url
} catch (error) {