mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
42 lines
1.2 KiB
Dart
42 lines
1.2 KiB
Dart
// lib/env/env.dart
|
|
import 'package:appflowy/startup/startup.dart';
|
|
import 'package:envied/envied.dart';
|
|
|
|
part 'env.g.dart';
|
|
|
|
/// The environment variables are defined in `.env` file that is located in the
|
|
/// appflowy_flutter.
|
|
/// Run `dart run build_runner build --delete-conflicting-outputs`
|
|
/// to generate the keys from the env file.
|
|
///
|
|
/// If you want to regenerate the keys, you need to run `dart run
|
|
/// build_runner clean` before running `dart run build_runner build
|
|
/// --delete-conflicting-outputs`.
|
|
|
|
/// Follow the guide on https://supabase.com/docs/guides/auth/social-login/auth-google to setup the auth provider.
|
|
///
|
|
@Envied(path: '.env')
|
|
abstract class Env {
|
|
@EnviedField(
|
|
obfuscate: true,
|
|
varName: 'SUPABASE_URL',
|
|
defaultValue: '',
|
|
)
|
|
static final String supabaseUrl = _Env.supabaseUrl;
|
|
@EnviedField(
|
|
obfuscate: true,
|
|
varName: 'SUPABASE_ANON_KEY',
|
|
defaultValue: '',
|
|
)
|
|
static final String supabaseAnonKey = _Env.supabaseAnonKey;
|
|
}
|
|
|
|
bool get isSupabaseEnabled {
|
|
// Only enable supabase in release and develop mode.
|
|
if (integrationMode().isRelease || integrationMode().isDevelop) {
|
|
return Env.supabaseUrl.isNotEmpty && Env.supabaseAnonKey.isNotEmpty;
|
|
} else {
|
|
return false;
|
|
}
|
|
}
|