Files
evilspins/server/plugins/initialSync.ts
valere 08db4d7388
All checks were successful
Deploy App / build (push) Successful in 48s
Deploy App / deploy (push) Successful in 22s
try fix CI
2026-02-10 17:57:56 +01:00

22 lines
612 B
TypeScript

import { syncCardsWithDatabase } from '../services/cardSync.service'
export default defineNitroPlugin(async (nitroApp) => {
const config = useRuntimeConfig()
const folderPath = config.PATH_FILES
if (!folderPath) {
console.warn('⚠️ PATH_FILES non configuré')
return
}
// Sync au démarrage
console.log('🚀 Synchronisation initiale au démarrage...')
try {
const result = await syncCardsWithDatabase(folderPath)
console.log('✅ Synchronisation initiale terminée:', result)
} catch (error: any) {
console.error('❌ Erreur lors de la sync initiale:', error)
}
})