로컬(개발)용과 운영용 설정분리
This commit is contained in:
@@ -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', () => {
|
||||
|
||||
Reference in New Issue
Block a user