From e97444244ae9957a294a7f63ebb2e5eb0c875753 Mon Sep 17 00:00:00 2001 From: kyuuseiryuu Date: Tue, 3 Mar 2026 14:16:29 +0900 Subject: [PATCH] feat: Add REDIS environment variable and update environment checks - Added REDIS environment variable to .env.example - Updated src/index.tsx to check for multiple required environment variables - Updated src/utils/server.ts to use REDIS environment variable for RedisClient --- .env.example | 3 ++- src/index.tsx | 8 ++++++-- src/utils/server.ts | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.env.example b/.env.example index b4da427..4fd88dc 100644 --- a/.env.example +++ b/.env.example @@ -1 +1,2 @@ -KAIQIUCC_TOKEN='' \ No newline at end of file +KAIQIUCC_TOKEN='' +REDIS='' \ No newline at end of file diff --git a/src/index.tsx b/src/index.tsx index 59af538..581f3c9 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -3,8 +3,12 @@ import { getMatchInfo, listEvent, xcxApi } from "./utils/server"; import index from "./index.html"; import { getUidScore } from "./services/uidScoreStore"; -if (!process.env.KAIQIUCC_TOKEN) { - console.error('env KAIQIUCC_TOKEN not found'); +const REQUIRED_ENVS = [ + process.env.KAIQIUCC_TOKEN, + process.env.REDIS, +]; +if (!REQUIRED_ENVS.every(Boolean)) { + console.error('Missing required environment variables. Please check your .env'); process.exit(1); } diff --git a/src/utils/server.ts b/src/utils/server.ts index 43eb747..472313b 100644 --- a/src/utils/server.ts +++ b/src/utils/server.ts @@ -6,7 +6,7 @@ import { RedisClient } from "bun"; export const xcxApi = new XCXAPI(process.env.KAIQIUCC_TOKEN ?? ''); -export const redis = new RedisClient('redis://default:redis_8YnmBw@192.168.50.126:6379'); +export const redis = new RedisClient(process.env.REDIS ?? ''); const htmlRequestHeaders = { "accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8",