fix(config): remove embedded supabase fallback values and require dart-defines
This commit is contained in:
parent
450d0a7b34
commit
25e0ade7a6
2 changed files with 10 additions and 3 deletions
|
|
@ -14,7 +14,7 @@ car64 is a Flutter + Supabase Hot Wheels collector app with a fast scanning work
|
||||||
## Local Development
|
## Local Development
|
||||||
|
|
||||||
1. Install Flutter (stable) and run `flutter doctor`.
|
1. Install Flutter (stable) and run `flutter doctor`.
|
||||||
2. Configure Supabase values via build-time variables (`--dart-define`), for example:
|
2. Configure Supabase values via build-time variables (`--dart-define`) — required (no fallback is embedded), for example:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
flutter run \
|
flutter run \
|
||||||
|
|
|
||||||
|
|
@ -18,11 +18,11 @@ export 'package:supabase_flutter/supabase_flutter.dart'
|
||||||
// ── Supabase credentials ──────────────────────────────────────────────
|
// ── Supabase credentials ──────────────────────────────────────────────
|
||||||
const _supabaseUrl = String.fromEnvironment(
|
const _supabaseUrl = String.fromEnvironment(
|
||||||
'SUPABASE_URL',
|
'SUPABASE_URL',
|
||||||
defaultValue: 'https://yaopcyubateifnicpywp.supabase.co',
|
defaultValue: '',
|
||||||
);
|
);
|
||||||
const _supabaseAnonKey = String.fromEnvironment(
|
const _supabaseAnonKey = String.fromEnvironment(
|
||||||
'SUPABASE_ANON_KEY',
|
'SUPABASE_ANON_KEY',
|
||||||
defaultValue: 'sb_publishable_a7czIl7-TGeBJvid9z2XZA_3ElImliL',
|
defaultValue: '',
|
||||||
);
|
);
|
||||||
const _usePkceAuthFlow = bool.fromEnvironment(
|
const _usePkceAuthFlow = bool.fromEnvironment(
|
||||||
'SUPABASE_USE_PKCE',
|
'SUPABASE_USE_PKCE',
|
||||||
|
|
@ -32,6 +32,13 @@ const _usePkceAuthFlow = bool.fromEnvironment(
|
||||||
Future<void> main() async {
|
Future<void> main() async {
|
||||||
WidgetsFlutterBinding.ensureInitialized();
|
WidgetsFlutterBinding.ensureInitialized();
|
||||||
|
|
||||||
|
if (_supabaseUrl.trim().isEmpty || _supabaseAnonKey.trim().isEmpty) {
|
||||||
|
throw StateError(
|
||||||
|
'Missing Supabase configuration. Provide --dart-define=SUPABASE_URL and '
|
||||||
|
'--dart-define=SUPABASE_ANON_KEY.',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
await Supabase.initialize(
|
await Supabase.initialize(
|
||||||
url: _supabaseUrl,
|
url: _supabaseUrl,
|
||||||
anonKey: _supabaseAnonKey,
|
anonKey: _supabaseAnonKey,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue