config.dart 836 B

123456789101112131415161718192021222324252627282930
  1. import 'package:appflowy_backend/dispatch/dispatch.dart';
  2. import 'package:appflowy_backend/protobuf/flowy-config/entities.pb.dart';
  3. class Config {
  4. static Future<void> setSupabaseConfig({
  5. required String url,
  6. required String anonKey,
  7. required String key,
  8. required String secret,
  9. required String pgUrl,
  10. required String pgUser,
  11. required String pgPassword,
  12. required String pgPort,
  13. }) async {
  14. final postgresConfig = PostgresConfigurationPB.create()
  15. ..url = pgUrl
  16. ..userName = pgUser
  17. ..password = pgPassword
  18. ..port = int.parse(pgPort);
  19. await ConfigEventSetSupabaseConfig(
  20. SupabaseConfigPB.create()
  21. ..supabaseUrl = url
  22. ..key = key
  23. ..anonKey = anonKey
  24. ..jwtSecret = secret
  25. ..postgresConfig = postgresConfig,
  26. ).send();
  27. }
  28. }