Starting infrastructure for server side image loading

This commit is contained in:
SpaghetGaming committed 2025-08-14 16:06:25 -04:00
1 parent 2ec6873ee0
commit 89c5e065de
8 files changed
+396 -7

No files matched your search

+12 -3
View File
@@ -2,8 +2,17 @@ import { Client, Storage } from "appwrite";
const client = new Client();
client
.setEndpoint(import.meta.env.APPWRITE_ENDPOINT) // Your Appwrite endpoint
.setProject(import.meta.env.APPWRITE_PROJECT_ID); // Your Project ID
// Check if we're in a server environment (SSR)
if (typeof window === 'undefined') {
// Server-side: use environment variables directly
client
.setEndpoint(process.env.APPWRITE_ENDPOINT!) // Your Appwrite endpoint
.setProject(process.env.APPWRITE_PROJECT_ID!); // Your Project ID
} else {
// Client-side: use import.meta.env
client
.setEndpoint(import.meta.env.APPWRITE_ENDPOINT) // Your Appwrite endpoint
.setProject(import.meta.env.APPWRITE_PROJECT_ID); // Your Project ID
}
export const storage = new Storage(client);