post-deploy fixins ffs
All checks were successful
Deploy to Web Server flyer-crawler.projectium.com / deploy (push) Successful in 19s

This commit is contained in:
2025-11-10 12:14:56 -08:00
parent d356960e95
commit 28ece0980c
3 changed files with 26 additions and 80 deletions

View File

@@ -1,33 +1,21 @@
import { createClient, SupabaseClient } from '@supabase/supabase-js';
import type { Flyer, FlyerItem, MasterGroceryItem, Profile, ShoppingList, ShoppingListItem } from '../types';
import type { Flyer, FlyerItem, MasterGroceryItem, Profile, ShoppingList, ShoppingListItem, Store } from '../types';
import { Database } from '../types/supabase';
export let supabase: SupabaseClient | null = null;
// In a Vite project, environment variables are exposed on the `import.meta.env` object.
// For security, only variables prefixed with `VITE_` are exposed to the client-side code.
const supabaseUrl = import.meta.env.VITE_SUPABASE_URL;
const supabaseAnonKey = import.meta.env.VITE_SUPABASE_ANON_KEY;
// Attempt to initialize from environment variables
const supabaseUrl = process.env.REACT_APP_SUPABASE_URL;
const supabaseAnonKey = process.env.REACT_APP_SUPABASE_ANON_KEY;
if (supabaseUrl && supabaseAnonKey) {
try {
supabase = createClient(supabaseUrl, supabaseAnonKey);
} catch (e) {
console.error("Failed to initialize Supabase from env vars:", e);
supabase = null;
}
if (!supabaseUrl || !supabaseAnonKey) {
console.warn("Supabase environment variables not set. Running in no-database mode.");
}
/**
* Initializes the Supabase client. Can be called with user-provided credentials.
* @param url - The Supabase project URL.
* @param key - The Supabase anon key.
* @returns The Supabase client instance.
*/
export const initializeSupabase = (url: string, key: string): SupabaseClient => {
if (!supabase) {
supabase = createClient(url, key);
}
return supabase;
};
// Create and export the Supabase client.
// If the keys are missing, this will be null, and features requiring it will be disabled.
export const supabase = (supabaseUrl && supabaseAnonKey)
? createClient<Database>(supabaseUrl, supabaseAnonKey)
: null;
/**
* Disconnects the Supabase client by setting the instance to null.