config: 사이트 도메인·서버 설정을 .env 로 중앙화 + 설치기 자동 종료 복구

- dotenv 도입, src/shared/env.ts 추가
  - loadEnv() 가 프로젝트 루트 .env 를 로드 (override=false: 쉘 env 우선)
  - getSiteBaseUrl() / getManifestUrl() 헬퍼
- 서버/설치기/리소스팩설치기 진입점에서 loadEnv() 호출
- 설치기 두 종의 기본 MANIFEST_URL 을 SITE_BASE_URL 기반으로 변경
  (운영 도메인을 한 곳에서만 바꾸면 됨)
- .env.example 템플릿 + .gitignore 에 .env 추가
- README / docs/admin-site.md 에 환경변수 표·사용법 추가
- installer/renderer.js: 4단계 완료 후 자동 종료 다시 활성화
This commit is contained in:
2026-05-13 02:55:58 +09:00
parent 894a86a117
commit 69ed4ad744
11 changed files with 117 additions and 10 deletions

View File

@@ -10,6 +10,7 @@ import type { ChildProcess } from 'node:child_process'
import type { Manifest, PackDefinition, PackList } from '../shared/types.js'
import { normalizePackDefinition } from '../shared/store.js'
import { getAppDataDir, getMcCustomDir } from '../shared/paths.js'
import { loadEnv, getManifestUrl } from '../shared/env.js'
import type { RpFetchedPack } from './types.js'
import { ensureYtDlpExe } from './ytdlp.js'
import { ensureFfmpegExe } from './ffmpeg.js'
@@ -17,6 +18,8 @@ import { downloadMusicTrack } from './music.js'
import { downloadImage, normalizeToCover, coverFileName } from './images.js'
import { buildResourcepackZip } from './pack.js'
loadEnv()
interface RpInstallerState {
manifestUrl: string
baseUrl: string
@@ -68,7 +71,7 @@ function acquireMusicStartSlot(): Promise<void> {
return slot
}
const DEFAULT_MANIFEST_URL = process.env.MANIFEST_URL ?? 'http://127.0.0.1:3000/manifest.json'
const DEFAULT_MANIFEST_URL = getManifestUrl()
const state: RpInstallerState = {
manifestUrl: DEFAULT_MANIFEST_URL,