env.dart 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. // lib/env/env.dart
  2. import 'package:appflowy/startup/startup.dart';
  3. import 'package:envied/envied.dart';
  4. part 'env.g.dart';
  5. /// The environment variables are defined in `.env` file that is located in the
  6. /// appflowy_flutter.
  7. /// Run `dart run build_runner build --delete-conflicting-outputs`
  8. /// to generate the keys from the env file.
  9. ///
  10. /// If you want to regenerate the keys, you need to run `dart run
  11. /// build_runner clean` before running `dart run build_runner build
  12. /// --delete-conflicting-outputs`.
  13. /// Follow the guide on https://supabase.com/docs/guides/auth/social-login/auth-google to setup the auth provider.
  14. ///
  15. @Envied(path: '.env')
  16. abstract class Env {
  17. @EnviedField(
  18. obfuscate: true,
  19. varName: 'SUPABASE_URL',
  20. defaultValue: '',
  21. )
  22. static final String supabaseUrl = _Env.supabaseUrl;
  23. @EnviedField(
  24. obfuscate: true,
  25. varName: 'SUPABASE_ANON_KEY',
  26. defaultValue: '',
  27. )
  28. static final String supabaseAnonKey = _Env.supabaseAnonKey;
  29. }
  30. bool get isSupabaseEnabled {
  31. // Only enable supabase in release and develop mode.
  32. if (integrationMode().isRelease || integrationMode().isDevelop) {
  33. return Env.supabaseUrl.isNotEmpty && Env.supabaseAnonKey.isNotEmpty;
  34. } else {
  35. return false;
  36. }
  37. }