mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2025-07-20 07:27:31 +00:00

* chore: env config * chore: get user workspace * feat: enable postgres storage * chore: add new env * chore: add set env ffi * chore: pass env before backend init * chore: update * fix: ci tests * chore: commit the generate env file * chore: remove unused import
50 lines
1.2 KiB
Dart
50 lines
1.2 KiB
Dart
import 'package:appflowy/core/config/config.dart';
|
|
import 'package:appflowy_backend/log.dart';
|
|
import 'package:supabase_flutter/supabase_flutter.dart';
|
|
|
|
import '../startup.dart';
|
|
|
|
bool isSupabaseEnable = false;
|
|
bool isSupabaseInitialized = false;
|
|
|
|
class InitSupabaseTask extends LaunchTask {
|
|
const InitSupabaseTask({
|
|
required this.url,
|
|
required this.anonKey,
|
|
required this.key,
|
|
required this.jwtSecret,
|
|
this.collabTable = "",
|
|
});
|
|
|
|
final String url;
|
|
final String anonKey;
|
|
final String key;
|
|
final String jwtSecret;
|
|
final String collabTable;
|
|
|
|
@override
|
|
Future<void> initialize(LaunchContext context) async {
|
|
if (url.isEmpty || anonKey.isEmpty || jwtSecret.isEmpty || key.isEmpty) {
|
|
isSupabaseEnable = false;
|
|
Log.info('Supabase config is empty, skip init supabase.');
|
|
return;
|
|
}
|
|
if (isSupabaseInitialized) {
|
|
return;
|
|
}
|
|
await Supabase.initialize(
|
|
url: url,
|
|
anonKey: anonKey,
|
|
debug: false,
|
|
);
|
|
await Config.setSupabaseConfig(
|
|
url: url,
|
|
key: key,
|
|
secret: jwtSecret,
|
|
anonKey: anonKey,
|
|
);
|
|
isSupabaseEnable = true;
|
|
isSupabaseInitialized = true;
|
|
}
|
|
}
|