M2: 사이트 서버 · 사이트 v1 - gvr.tkrmagid.kr 배포
- site/server: Discord OAuth2 + 봇 토큰 멤버 확인, 세션, 1회용 등록 코드·기기 키 인증, 게임 PC WebSocket 중계(JSON·음성 바이너리), 15초 무응답 잠금, 게임 이미지 캐시, 관리 CLI - site/web: 타임라인·따라 읽기 재생(단어 강조·이어듣기·현장 모드·재생 게인)·필터·검색·실시간·교정, 발로란트/롤 경기 상세, 잠금 화면(관리자 등록 코드), 모바일, 효과음 - deploy/site: Dockerfile·compose·deploy.sh·make-env.sh (.5, 포트 2972) - 앱 코어: 사이트 필터 묶음(킬·라운드)과 유저 필터 규칙 맞춤, hello 에 서버 ID Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
48
site/server/src/config.ts
Normal file
48
site/server/src/config.ts
Normal file
@@ -0,0 +1,48 @@
|
||||
import path from 'node:path';
|
||||
|
||||
export interface Config {
|
||||
port: number;
|
||||
host: string;
|
||||
publicUrl: string;
|
||||
clientId: string;
|
||||
clientSecret: string;
|
||||
botToken: string;
|
||||
/** 로그인 허용 디스코드 서버 (기본: M&L). 게임 PC 가 알려 준 서버도 함께 허용 */
|
||||
allowedGuilds: string[];
|
||||
owners: string[];
|
||||
sessionSecret: string;
|
||||
dataDir: string;
|
||||
webDir: string;
|
||||
version: string;
|
||||
/** 테스트용: 디스코드 API 주소 바꾸기 */
|
||||
discordApi: string;
|
||||
assetUpstream: Record<string, string>;
|
||||
}
|
||||
|
||||
export function loadConfig(env = process.env): Config {
|
||||
const need = (k: string) => {
|
||||
const v = env[k];
|
||||
if (!v) throw new Error(`환경변수 ${k} 가 필요합니다`);
|
||||
return v;
|
||||
};
|
||||
return {
|
||||
port: Number(env.PORT || 8080),
|
||||
host: env.HOST || '0.0.0.0',
|
||||
publicUrl: (env.PUBLIC_URL || 'https://gvr.tkrmagid.kr').replace(/\/$/, ''),
|
||||
clientId: need('DISCORD_CLIENT_ID'),
|
||||
clientSecret: need('DISCORD_CLIENT_SECRET'),
|
||||
botToken: need('DISCORD_BOT_TOKEN'),
|
||||
allowedGuilds: (env.ALLOWED_GUILD_IDS || '').split(',').map((s) => s.trim()).filter(Boolean),
|
||||
owners: (env.OWNER_DISCORD_IDS || '').split(',').map((s) => s.trim()).filter(Boolean),
|
||||
sessionSecret: need('SESSION_SECRET'),
|
||||
dataDir: env.DATA_DIR || path.resolve('data'),
|
||||
webDir: env.WEB_DIR || path.resolve('../web/dist'),
|
||||
version: env.GVR_VERSION || '1.0.0',
|
||||
discordApi: env.DISCORD_API || 'https://discord.com/api/v10',
|
||||
assetUpstream: {
|
||||
valmedia: 'https://media.valorant-api.com/',
|
||||
ddragon: 'https://ddragon.leagueoflegends.com/',
|
||||
cdragon: 'https://raw.communitydragon.org/',
|
||||
},
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user