Added auto-backups feature (#107)

This commit is contained in:
Doh
2025-04-17 23:18:37 -04:00
committed by GitHub
parent 909bfa7c6f
commit dda8b522e3
14 changed files with 826 additions and 32 deletions

View File

@@ -1,7 +1,28 @@
import { init } from '@/lib/env.server' // startup env var check
import { init } from '@/lib/env.server'; // startup env var check
export function register() {
if (typeof window === "undefined") {
init()
}
}
// Ensure this function is exported
export async function register() {
// We only want to run this code on the server side
if (process.env.NEXT_RUNTIME === 'nodejs') {
console.log('Node.js runtime detected, running server-side instrumentation...');
// Initialize environment variables first
console.log('Initializing environment variables...');
init();
console.log('Environment variables initialized.');
// Dynamically import the scheduler initializer
// Use await import() for ESM compatibility
try {
console.log('Attempting to import scheduler...');
// Ensure the path is correct relative to the project root
const { initializeScheduler } = await import('./lib/scheduler');
console.log('Scheduler imported successfully. Initializing...');
initializeScheduler();
console.log('Scheduler initialization called.');
} catch (error) {
console.error('Failed to import or initialize scheduler:', error);
}
} else {
console.log(`Instrumentation hook running in environment: ${process.env.NEXT_RUNTIME}. Skipping server-side initialization.`);
}
}