mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2025-07-23 00:52:14 +00:00

* refactor: using tokio-postgres * chore: update * chore: update env * chore: update * chore: upgrade supabase and add logout button * refactor: update * chore: update * refactor: using message queue to handle the pg connection * refactor: move test * refactor: update sql * chore: create pg database when user login * chore: update scheme * chore: generic user service * chore: update * chore: create statistics * chore: create snapshot * chore: add test * chore: add database cloud service * chore: add document cloud service * chore: update interface * test: add document test * refactor: document interface * chore: fix test * chore: update * chore: update test * test: add test * test: add test * test: add test * chore: update collab rev * fix: flutter analyzer * chore: update * chore: update * chore: update * fix: tests * chore: update * chore: update collab rev * ci: rust fmt --------- Co-authored-by: Lucas.Xu <lucas.xu@appflowy.io>
38 lines
903 B
Dart
38 lines
903 B
Dart
import 'package:appflowy/core/config/config.dart';
|
|
import 'package:appflowy/env/env.dart';
|
|
import 'package:supabase_flutter/supabase_flutter.dart';
|
|
|
|
import '../startup.dart';
|
|
|
|
bool isSupabaseInitialized = false;
|
|
|
|
class InitSupabaseTask extends LaunchTask {
|
|
@override
|
|
Future<void> initialize(LaunchContext context) async {
|
|
if (!isSupabaseEnable) {
|
|
return;
|
|
}
|
|
|
|
if (isSupabaseInitialized) {
|
|
return;
|
|
}
|
|
await Supabase.initialize(
|
|
url: Env.supabaseUrl,
|
|
anonKey: Env.supabaseAnonKey,
|
|
debug: false,
|
|
);
|
|
|
|
await Config.setSupabaseConfig(
|
|
url: Env.supabaseUrl,
|
|
key: Env.supabaseKey,
|
|
secret: Env.supabaseJwtSecret,
|
|
anonKey: Env.supabaseAnonKey,
|
|
pgPassword: Env.supabaseDbPassword,
|
|
pgPort: Env.supabaseDbPort,
|
|
pgUrl: Env.supabaseDb,
|
|
pgUser: Env.supabaseDbUser,
|
|
);
|
|
isSupabaseInitialized = true;
|
|
}
|
|
}
|