로컬(개발)용과 운영용 설정분리
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', () => {
|
||||
|
||||
@@ -1,14 +1,19 @@
|
||||
import { initPubnetTables } from '../utils/db'
|
||||
import { initPubnetTables, shouldAutoStartScheduler } from '../utils/db'
|
||||
import { pubnetScheduler } from '../utils/pubnet-scheduler'
|
||||
|
||||
export default defineNitroPlugin((nitroApp) => {
|
||||
export default defineNitroPlugin(async (nitroApp) => {
|
||||
console.log('[Plugin] pubnet-init starting...')
|
||||
|
||||
// DB 테이블 초기화
|
||||
initPubnetTables()
|
||||
await initPubnetTables()
|
||||
|
||||
// 스케줄러 자동 시작
|
||||
pubnetScheduler.start()
|
||||
// 스케줄러 자동 시작 (환경에 따라)
|
||||
if (shouldAutoStartScheduler()) {
|
||||
pubnetScheduler.start()
|
||||
console.log('[Plugin] pubnet scheduler auto-started (production mode)')
|
||||
} else {
|
||||
console.log('[Plugin] pubnet scheduler NOT started (development mode - use API to start)')
|
||||
}
|
||||
|
||||
// 서버 종료 시 클린업
|
||||
nitroApp.hooks.hook('close', () => {
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
import { shouldAutoStartScheduler } from '../utils/db'
|
||||
import { startServerScheduler } from '../utils/server-scheduler'
|
||||
|
||||
export default defineNitroPlugin(() => {
|
||||
// 서버 시작 시 스케줄러 자동 시작
|
||||
startServerScheduler()
|
||||
|
||||
console.log('[Server] Plugin initialized - scheduler auto-started')
|
||||
// 스케줄러 자동 시작 (환경에 따라)
|
||||
if (shouldAutoStartScheduler()) {
|
||||
startServerScheduler()
|
||||
console.log('[Server] Plugin initialized - scheduler auto-started (production mode)')
|
||||
} else {
|
||||
console.log('[Server] Plugin initialized - scheduler NOT started (development mode - use API to start)')
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user