21 lines
543 B
TypeScript
21 lines
543 B
TypeScript
import { initPubnetTables } from '../utils/db'
|
|
import { pubnetScheduler } from '../utils/pubnet-scheduler'
|
|
|
|
export default defineNitroPlugin((nitroApp) => {
|
|
console.log('[Plugin] pubnet-init starting...')
|
|
|
|
// DB 테이블 초기화
|
|
initPubnetTables()
|
|
|
|
// 스케줄러 자동 시작
|
|
pubnetScheduler.start()
|
|
|
|
// 서버 종료 시 클린업
|
|
nitroApp.hooks.hook('close', () => {
|
|
console.log('[Plugin] Shutting down pubnet scheduler...')
|
|
pubnetScheduler.stop()
|
|
})
|
|
|
|
console.log('[Plugin] pubnet-init completed')
|
|
})
|