From e3e14a229a25ba115718bef680906a7e556e65b9 Mon Sep 17 00:00:00 2001 From: Luke Berndt Date: Mon, 19 Aug 2024 17:09:09 -0400 Subject: [PATCH] ability to use a different public URL for S3 --- backend/controllers/uploads.js | 4 ++-- backend/index.js | 2 +- docker-compose.yml | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/backend/controllers/uploads.js b/backend/controllers/uploads.js index 8babaf4..072078f 100644 --- a/backend/controllers/uploads.js +++ b/backend/controllers/uploads.js @@ -21,7 +21,7 @@ var s3_endpoint = process.env['S3_ENDPOINT'] != null ? process.env['S3_ENDPOINT' var s3_region = process.env['S3_REGION'] != null ? process.env['S3_REGION'] : 'us-west-1'; var s3_bucket = process.env['S3_BUCKET'] != null ? process.env['S3_BUCKET'] : 'openmhz-west'; var s3_profile = process.env['S3_PROFILE'] != null ? process.env['S3_PROFILE'] : 'wasabi-account'; - +var s3_public_url = process.env['S3_PUBLIC_URL'] != null ? process.env['S3_PUBLIC_URL'] : s3_endpoint + "/" + s3_bucket; const client = new S3Client({ requestHandler: new NodeHttpHandler({ @@ -165,7 +165,7 @@ exports.upload = async function (req, res, next) { var endpoint = s3_endpoint; var bucket = s3_bucket; - var url = s3_endpoint + "/" + s3_bucket + "/" + object_key; + var url = s3_public_url + "/" + object_key; var call = new Call({ shortName: shortName, diff --git a/backend/index.js b/backend/index.js index b49bad5..54e481e 100644 --- a/backend/index.js +++ b/backend/index.js @@ -270,7 +270,7 @@ io.sockets.on('connection', function (client) { if (typeof clients[client.id] === "undefined") { console.error("How can it be undefined here!!"); - console.error(clients[client.id]); + console.error(client.id); return; } if (group) { diff --git a/docker-compose.yml b/docker-compose.yml index fdb7e7a..479cc1e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -77,6 +77,7 @@ services: - S3_BUCKET - S3_PROFILE - S3_REGION + - S3_PUBLIC_URL - OTEL_SERVICE_NAME - HONEYCOMB_API_KEY volumes: