mirror of
http://forgejo-oa09toasww4dgii9cj3gpzda.187.127.164.61.sslip.io/iamcoolvivek007/bharath.git
synced 2026-06-11 00:06:51 +00:00
Fix: accept NEXT_PUBLIC_ env var names for Supabase
This commit is contained in:
parent
a728235882
commit
2d695c6090
1 changed files with 5 additions and 3 deletions
|
|
@ -1,7 +1,9 @@
|
||||||
const { createClient } = require('@supabase/supabase-js');
|
const { createClient } = require('@supabase/supabase-js');
|
||||||
const config = require('../config/env');
|
|
||||||
|
|
||||||
if (!config.supabase.url || !config.supabase.key) {
|
const supabaseUrl = process.env.SUPABASE_URL || process.env.NEXT_PUBLIC_SUPABASE_URL;
|
||||||
|
const supabaseKey = process.env.SUPABASE_KEY || process.env.NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY || process.env.SUPABASE_ANON_KEY;
|
||||||
|
|
||||||
|
if (!supabaseUrl || !supabaseKey) {
|
||||||
console.error('Missing SUPABASE_URL or SUPABASE_KEY. Check .env file.');
|
console.error('Missing SUPABASE_URL or SUPABASE_KEY. Check .env file.');
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
|
@ -11,6 +13,6 @@ if (typeof globalThis.WebSocket === 'undefined') {
|
||||||
options.realtime = { transport: require('ws') };
|
options.realtime = { transport: require('ws') };
|
||||||
}
|
}
|
||||||
|
|
||||||
const supabase = createClient(config.supabase.url, config.supabase.key, options);
|
const supabase = createClient(supabaseUrl, supabaseKey, options);
|
||||||
|
|
||||||
module.exports = supabase;
|
module.exports = supabase;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue