Integrate Bunny.net for storing user-uploaded videos
Update server/storage.ts to prioritize Bunny.net storage if configured, falling back to database or memory storage. Replit-Commit-Author: Agent Replit-Commit-Session-Id: d7424866-83d1-4486-a212-ac12b4c7becf Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/8cc42625-c1f5-4e43-99bd-77f2c4dedee2/d7424866-83d1-4486-a212-ac12b4c7becf/ESknBgQ
This commit is contained in:
parent
257e16e8d2
commit
640bcd82cf
@ -797,9 +797,28 @@ let storage: IStorage;
|
|||||||
const hasDatabase = process.env.DATABASE_URL;
|
const hasDatabase = process.env.DATABASE_URL;
|
||||||
const hasBunnyConfig = process.env.BUNNY_API_KEY && process.env.BUNNY_LIBRARY_ID && process.env.BUNNY_HOSTNAME;
|
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
|
// Prioritize Bunny.net storage for user's video content
|
||||||
// Database implementation is ready but needs proper database setup
|
if (hasBunnyConfig) {
|
||||||
console.log('📁 Using memory storage for reliable backend demonstration');
|
try {
|
||||||
storage = new MemStorage();
|
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 };
|
export { storage };
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user