Files
ai-showcase-platform/lib/app-initializer.ts

34 lines
1.0 KiB
TypeScript

// =====================================================
// 應用程式初始化器
// =====================================================
import { dbShutdownManager } from './database-shutdown-manager';
import { startConnectionMonitoring } from './database-middleware';
// 應用程式初始化
export function initializeApp() {
console.log('🚀 正在初始化應用程式...');
try {
// 初始化資料庫關閉管理器
console.log('📋 初始化資料庫關閉管理器...');
const shutdownStatus = dbShutdownManager.getShutdownStatus();
console.log('✅ 資料庫關閉管理器已初始化:', shutdownStatus);
// 啟動資料庫連線監控
console.log('📊 啟動資料庫連線監控...');
startConnectionMonitoring();
console.log('✅ 應用程式初始化完成');
} catch (error) {
console.error('❌ 應用程式初始化失敗:', error);
}
}
// 在模組載入時自動初始化
if (typeof window === 'undefined') {
// 只在伺服器端執行
initializeApp();
}