From 837abe0ea960d5a8137f0904d8b471390c03bf4c Mon Sep 17 00:00:00 2001 From: CN-JS-HuiBai Date: Sat, 4 Apr 2026 12:28:44 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DPM2=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E5=90=AF=E5=8A=A8=E7=9A=84=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.example | 1 + ecosystem.config.js | 3 ++- server.js | 4 +++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.env.example b/.env.example index d33d5d8..953fee0 100644 --- a/.env.example +++ b/.env.example @@ -15,3 +15,4 @@ APP_TITLE=S3 Media Transcoder # Session Cache (Valkey / Redis) VALKEY_URL=redis://localhost:6379 VALKEY_DB=0 +VALKEY_PREFIX=mediaconverter diff --git a/ecosystem.config.js b/ecosystem.config.js index 80a679e..e24777e 100644 --- a/ecosystem.config.js +++ b/ecosystem.config.js @@ -19,7 +19,8 @@ module.exports = { S3_FORCE_PATH_STYLE: 'true', APP_TITLE: 'S3 Media Transcoder', VALKEY_URL: 'redis://localhost:6379', - VALKEY_DB: 0 + VALKEY_DB: 0, + VALKEY_PREFIX: 'mediaconverter' } } ] diff --git a/server.js b/server.js index 7f884ff..18ece72 100644 --- a/server.js +++ b/server.js @@ -33,8 +33,10 @@ if (typeof ffmpeg.setFfprobePath === 'function') { const redisUrl = process.env.VALKEY_URL || process.env.REDIS_URL || 'redis://localhost:6379'; const redisDb = parseInt(process.env.VALKEY_DB || process.env.REDIS_DB || '0', 10); +const redisPrefix = process.env.VALKEY_PREFIX || process.env.REDIS_PREFIX || ''; const redisClient = new Redis(redisUrl, { - db: isNaN(redisDb) ? 0 : redisDb + db: isNaN(redisDb) ? 0 : redisDb, + keyPrefix: redisPrefix ? (redisPrefix.endsWith(':') ? redisPrefix : redisPrefix + ':') : '' }); app.use(cors());