first commit
This commit is contained in:
17
lib/core/config/admin_whitelist.dart
Normal file
17
lib/core/config/admin_whitelist.dart
Normal file
@@ -0,0 +1,17 @@
|
||||
class AdminWhitelist {
|
||||
const AdminWhitelist._();
|
||||
|
||||
// Whitelist of admin emails.
|
||||
// In a real production app, this should be handled via database roles (RBAC).
|
||||
static const Set<String> emails = {
|
||||
'admin@riotz.com',
|
||||
'root@riotz.com',
|
||||
'creator@riotz.com',
|
||||
};
|
||||
|
||||
/// Checks if a user is an admin based on their email.
|
||||
static bool isAdmin(String? email) {
|
||||
if (email == null) return false;
|
||||
return emails.contains(email.toLowerCase());
|
||||
}
|
||||
}
|
||||
22
lib/core/config/supabase_config.dart
Normal file
22
lib/core/config/supabase_config.dart
Normal file
@@ -0,0 +1,22 @@
|
||||
import 'package:supabase_flutter/supabase_flutter.dart';
|
||||
|
||||
class SupabaseConfig {
|
||||
const SupabaseConfig._();
|
||||
|
||||
static const _url = String.fromEnvironment('SUPABASE_URL');
|
||||
static const _anonKey = String.fromEnvironment('SUPABASE_ANON_KEY');
|
||||
|
||||
static Future<void> initialize() async {
|
||||
if (_url.isEmpty || _anonKey.isEmpty) {
|
||||
throw StateError(
|
||||
'Missing Supabase env values. Provide SUPABASE_URL and SUPABASE_ANON_KEY '
|
||||
'using --dart-define.',
|
||||
);
|
||||
}
|
||||
|
||||
await Supabase.initialize(
|
||||
url: _url,
|
||||
anonKey: _anonKey,
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user