Skip to content

Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.

chore: remove jwt secret env variable (#3291)

Nathan.fooo897d7980f651
diff --git a/frontend/appflowy_flutter/lib/env/env.dart b/frontend/appflowy_flutter/lib/env/env.dart
index 6d2288c792..5f6a5d6ec5 100644
--- a/frontend/appflowy_flutter/lib/env/env.dart
+++ b/frontend/appflowy_flutter/lib/env/env.dart
@@ -29,21 +29,12 @@ abstract class Env {
defaultValue: '',
)
static final String supabaseAnonKey = _Env.supabaseAnonKey;
-
- @EnviedField(
- obfuscate: true,
- varName: 'SUPABASE_JWT_SECRET',
- defaultValue: '',
- )
- static final String supabaseJwtSecret = _Env.supabaseJwtSecret;
}
bool get isSupabaseEnabled {
// Only enable supabase in release and develop mode.
if (integrationMode().isRelease || integrationMode().isDevelop) {
- return Env.supabaseUrl.isNotEmpty &&
- Env.supabaseAnonKey.isNotEmpty &&
- Env.supabaseJwtSecret.isNotEmpty;
+ return Env.supabaseUrl.isNotEmpty && Env.supabaseAnonKey.isNotEmpty;
} else {
return false;
}
diff --git a/frontend/appflowy_flutter/lib/startup/tasks/rust_sdk.dart b/frontend/appflowy_flutter/lib/startup/tasks/rust_sdk.dart
index 925f80be37..42d1360aa9 100644
--- a/frontend/appflowy_flutter/lib/startup/tasks/rust_sdk.dart
+++ b/frontend/appflowy_flutter/lib/startup/tasks/rust_sdk.dart
@@ -34,7 +34,6 @@ AppFlowyEnv getAppFlowyEnv() {
enable_sync: true,
url: Env.supabaseUrl,
anon_key: Env.supabaseAnonKey,
- jwt_secret: Env.supabaseJwtSecret,
);
return AppFlowyEnv(
diff --git a/frontend/appflowy_flutter/packages/appflowy_backend/lib/env_serde.dart b/frontend/appflowy_flutter/packages/appflowy_backend/lib/env_serde.dart
index 1fc6077a3a..a34d7fbaef 100644
--- a/frontend/appflowy_flutter/packages/appflowy_backend/lib/env_serde.dart
+++ b/frontend/appflowy_flutter/packages/appflowy_backend/lib/env_serde.dart
@@ -27,13 +27,11 @@ class SupabaseConfiguration {
final bool enable_sync;
final String url;
final String anon_key;
- final String jwt_secret;
SupabaseConfiguration({
this.enable_sync = true,
required this.url,
required this.anon_key,
- required this.jwt_secret,
});
factory SupabaseConfiguration.fromJson(Map<String, dynamic> json) =>
diff --git a/frontend/appflowy_flutter/packages/appflowy_backend/lib/env_serde.i.dart b/frontend/appflowy_flutter/packages/appflowy_backend/lib/env_serde.i.dart
index 892275ed1d..3dd6fb3c70 100644
--- a/frontend/appflowy_flutter/packages/appflowy_backend/lib/env_serde.i.dart
+++ b/frontend/appflowy_flutter/packages/appflowy_backend/lib/env_serde.i.dart
@@ -22,7 +22,6 @@ SupabaseConfiguration _$SupabaseConfigurationFromJson(
enable_sync: json['enable_sync'] as bool? ?? true,
url: json['url'] as String,
anon_key: json['anon_key'] as String,
- jwt_secret: json['jwt_secret'] as String,
);
Map<String, dynamic> _$SupabaseConfigurationToJson(
@@ -31,5 +30,4 @@ Map<String, dynamic> _$SupabaseConfigurationToJson(
'enable_sync': instance.enable_sync,
'url': instance.url,
'anon_key': instance.anon_key,
- 'jwt_secret': instance.jwt_secret,
};
diff --git a/frontend/rust-lib/flowy-server-config/src/supabase_config.rs b/frontend/rust-lib/flowy-server-config/src/supabase_config.rs
index c7fddf1823..0e7c37416d 100644
--- a/frontend/rust-lib/flowy-server-config/src/supabase_config.rs
+++ b/frontend/rust-lib/flowy-server-config/src/supabase_config.rs
@@ -5,7 +5,6 @@ use flowy_error::{ErrorCode, FlowyError};
pub const ENABLE_SUPABASE_SYNC: &str = "ENABLE_SUPABASE_SYNC";
pub const SUPABASE_URL: &str = "SUPABASE_URL";
pub const SUPABASE_ANON_KEY: &str = "SUPABASE_ANON_KEY";
-pub const SUPABASE_JWT_SECRET: &str = "SUPABASE_JWT_SECRET";
pub const SUPABASE_DB: &str = "SUPABASE_DB";
pub const SUPABASE_DB_USER: &str = "SUPABASE_DB_USER";
@@ -20,8 +19,6 @@ pub struct SupabaseConfiguration {
pub url: String,
/// The key of the supabase server.
pub anon_key: String,
- /// The secret used to sign the JWT tokens.
- pub jwt_secret: String,
}
impl SupabaseConfiguration {
@@ -31,9 +28,6 @@ impl SupabaseConfiguration {
.map_err(|_| FlowyError::new(ErrorCode::InvalidAuthConfig, "Missing SUPABASE_URL"))?,
anon_key: std::env::var(SUPABASE_ANON_KEY)
.map_err(|_| FlowyError::new(ErrorCode::InvalidAuthConfig, "Missing SUPABASE_ANON_KEY"))?,
- jwt_secret: std::env::var(SUPABASE_JWT_SECRET).map_err(|_| {
- FlowyError::new(ErrorCode::InvalidAuthConfig, "Missing SUPABASE_JWT_SECRET")
- })?,
})
}
@@ -41,6 +35,5 @@ impl SupabaseConfiguration {
pub fn write_env(&self) {
std::env::set_var(SUPABASE_URL, &self.url);
std::env::set_var(SUPABASE_ANON_KEY, &self.anon_key);
- std::env::set_var(SUPABASE_JWT_SECRET, &self.jwt_secret);
}
}