로컬(개발)용과 운영용 설정분리

This commit is contained in:
2025-12-28 13:45:41 +09:00
parent a871ec8008
commit 716f4f8791
15 changed files with 661 additions and 368 deletions

View File

@@ -1,14 +1,19 @@
import { initPrivnetTables } from '../utils/db'
import { initPrivnetTables, shouldAutoStartScheduler } from '../utils/db'
import { privnetScheduler } from '../utils/privnet-scheduler'
export default defineNitroPlugin((nitroApp) => {
export default defineNitroPlugin(async (nitroApp) => {
console.log('[Plugin] privnet-init starting...')
// DB 테이블 초기화
initPrivnetTables()
await initPrivnetTables()
// 스케줄러 자동 시작
privnetScheduler.start()
// 스케줄러 자동 시작 (환경에 따라)
if (shouldAutoStartScheduler()) {
privnetScheduler.start()
console.log('[Plugin] privnet scheduler auto-started (production mode)')
} else {
console.log('[Plugin] privnet scheduler NOT started (development mode - use API to start)')
}
// 서버 종료 시 클린업
nitroApp.hooks.hook('close', () => {