From bc78c8261601859db7139f26f9ed23e848312124 Mon Sep 17 00:00:00 2001 From: srgooglo Date: Sat, 22 Feb 2025 06:21:31 +0100 Subject: [PATCH] use node_env --- Dockerfile | 2 +- node_api/api/index.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6678839..c869a1b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,4 +18,4 @@ RUN cd /home/node/app/node_api/api && npm install -D --force RUN cd /home/node/app/node_api/web && npm install -D --force RUN cd /home/node/app/node_api/web && npm run build -CMD ["node", "/home/node/app/node_api/api/index.js"] \ No newline at end of file +CMD ["NODE_ENV=production", "node", "/home/node/app/node_api/api/index.js"] diff --git a/node_api/api/index.js b/node_api/api/index.js index 394646c..10f29c3 100644 --- a/node_api/api/index.js +++ b/node_api/api/index.js @@ -81,7 +81,7 @@ async function fetchTTSAudioURL(req, phrase, phraseId) { await synthesizePollyVoice(phrase, phraseId) } - return `${req.protocol}://${req.get("host")}${req.path}/audio/${phraseId}.mp3` + return `${NODE_ENV === "production" ? "https" : req.protocol}://${req.get("host")}${req.path}/audio/${phraseId}.mp3` } async function handleApiRequest(req, res) {