Skip to content

Commit 34b2b03

Browse files
committed
fix: back to basics
1 parent 71e1a58 commit 34b2b03

1 file changed

Lines changed: 3 additions & 8 deletions

File tree

lib/main.dart

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,16 @@ Future<void> main() async {
1717
late String supabaseApiKey;
1818

1919
// Load environment variables
20-
if (kIsWeb) {
21-
// For web build, load from 'dotenv' file in root
22-
await dotenv.load(fileName: 'dotenv');
23-
supabaseUrl = dotenv.env['SUPABASE_URL'] ?? '';
24-
supabaseApiKey = dotenv.env['SUPABASE_KEY'] ?? '';
25-
} else {
26-
// For local dev, load from '.env' file
20+
if (kIsWeb || !kIsWeb) {
21+
// For web and local dev, load from .env file
2722
await dotenv.load(fileName: '.env');
2823
supabaseUrl = dotenv.env['SUPABASE_URL'] ?? '';
2924
supabaseApiKey = dotenv.env['SUPABASE_KEY'] ?? '';
3025
}
3126

3227
// Validate environment variables
3328
if (supabaseUrl.isEmpty || supabaseApiKey.isEmpty) {
34-
throw Exception('SUPABASE_URL and SUPABASE_KEY must be provided in the environment file');
29+
throw Exception('SUPABASE_URL and SUPABASE_KEY must be provided in .env file');
3530
}
3631

3732
final instance = await Supabase.initialize(

0 commit comments

Comments
 (0)