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
This commit is contained in:
parent
7f8196249b
commit
e97444244a
@ -1 +1,2 @@
|
|||||||
KAIQIUCC_TOKEN=''
|
KAIQIUCC_TOKEN=''
|
||||||
|
REDIS=''
|
||||||
@ -3,8 +3,12 @@ import { getMatchInfo, listEvent, xcxApi } from "./utils/server";
|
|||||||
import index from "./index.html";
|
import index from "./index.html";
|
||||||
import { getUidScore } from "./services/uidScoreStore";
|
import { getUidScore } from "./services/uidScoreStore";
|
||||||
|
|
||||||
if (!process.env.KAIQIUCC_TOKEN) {
|
const REQUIRED_ENVS = [
|
||||||
console.error('env KAIQIUCC_TOKEN not found');
|
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);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@ import { RedisClient } from "bun";
|
|||||||
|
|
||||||
export const xcxApi = new XCXAPI(process.env.KAIQIUCC_TOKEN ?? '');
|
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 = {
|
const htmlRequestHeaders = {
|
||||||
"accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8",
|
"accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8",
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user