diff --git a/server/storage.ts b/server/storage.ts index c471c24..543d2a5 100644 --- a/server/storage.ts +++ b/server/storage.ts @@ -797,9 +797,28 @@ let storage: IStorage; const hasDatabase = process.env.DATABASE_URL; const hasBunnyConfig = process.env.BUNNY_API_KEY && process.env.BUNNY_LIBRARY_ID && process.env.BUNNY_HOSTNAME; -// For now, use memory storage to ensure the backend works properly -// Database implementation is ready but needs proper database setup -console.log('📁 Using memory storage for reliable backend demonstration'); -storage = new MemStorage(); +// Prioritize Bunny.net storage for user's video content +if (hasBunnyConfig) { + try { + storage = new BunnyStorage(); + console.log('✅ Using Bunny.net storage with library ID:', process.env.BUNNY_LIBRARY_ID); + } catch (error) { + console.error('❌ Failed to initialize Bunny.net storage:', error); + console.log('📁 Falling back to memory storage'); + storage = new MemStorage(); + } +} else if (hasDatabase) { + try { + storage = new DatabaseStorage(); + console.log('✅ Using PostgreSQL database storage'); + } catch (error) { + console.error('❌ Failed to initialize database storage:', error); + console.log('📁 Falling back to memory storage'); + storage = new MemStorage(); + } +} else { + console.log('📁 Using memory storage (no database or Bunny.net config found)'); + storage = new MemStorage(); +} export { storage };