Member/Ecology revamp.
Some checks failed
Test / vitest (push) Failing after 7m23s
Test / playwright (push) Has been skipped
Test / visual (push) Has been skipped
Test / Notify on failure (push) Successful in 2s

This commit is contained in:
Jennie Robinson Faber 2026-04-14 09:25:09 +01:00
parent fc7ec52574
commit 59d6e97787
31 changed files with 1763 additions and 1010 deletions

View file

@ -0,0 +1,26 @@
import { syncWikiArticles } from '../utils/syncWikiArticles.js'
const INTERVAL_MS = 86400000 // 24 hours
export default defineNitroPlugin(() => {
if (process.env.NODE_ENV === 'test') return
const config = useRuntimeConfig()
if (!config.outlineApiKey) {
console.warn('[wiki-sync] No Outline API key configured, skipping background sync')
return
}
async function run() {
try {
const result = await syncWikiArticles()
console.log(`[wiki-sync] Done: ${result.created} created, ${result.updated} updated, ${result.deleted} removed, ${result.errors} errors`)
} catch (err) {
console.error('[wiki-sync] Unhandled error:', err.message || err)
}
}
// Run on server start, then every 24 hours
run()
setInterval(run, INTERVAL_MS)
})