2023-11-05 14:00:24 +08:00
|
|
|
// ignore_for_file: non_constant_identifier_names
|
2023-05-23 23:55:21 +08:00
|
|
|
|
2023-11-05 14:00:24 +08:00
|
|
|
import 'package:json_annotation/json_annotation.dart';
|
|
|
|
part 'backend_env.g.dart';
|
2023-05-23 23:55:21 +08:00
|
|
|
|
|
|
|
@JsonSerializable()
|
|
|
|
class AppFlowyEnv {
|
2023-11-17 15:38:56 +08:00
|
|
|
final int cloud_type;
|
2023-05-23 23:55:21 +08:00
|
|
|
final SupabaseConfiguration supabase_config;
|
2023-10-02 17:22:22 +08:00
|
|
|
final AppFlowyCloudConfiguration appflowy_cloud_config;
|
2023-05-23 23:55:21 +08:00
|
|
|
|
2023-07-14 13:37:13 +08:00
|
|
|
AppFlowyEnv({
|
2023-11-17 15:38:56 +08:00
|
|
|
required this.cloud_type,
|
2023-07-14 13:37:13 +08:00
|
|
|
required this.supabase_config,
|
2023-10-02 17:22:22 +08:00
|
|
|
required this.appflowy_cloud_config,
|
2023-07-14 13:37:13 +08:00
|
|
|
});
|
2023-05-23 23:55:21 +08:00
|
|
|
|
|
|
|
factory AppFlowyEnv.fromJson(Map<String, dynamic> json) =>
|
|
|
|
_$AppFlowyEnvFromJson(json);
|
|
|
|
|
|
|
|
Map<String, dynamic> toJson() => _$AppFlowyEnvToJson(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
@JsonSerializable()
|
|
|
|
class SupabaseConfiguration {
|
2023-07-14 13:37:13 +08:00
|
|
|
/// Indicates whether the sync feature is enabled.
|
2023-05-23 23:55:21 +08:00
|
|
|
final String url;
|
2023-07-29 09:46:24 +08:00
|
|
|
final String anon_key;
|
2023-05-23 23:55:21 +08:00
|
|
|
|
2023-07-05 20:57:09 +08:00
|
|
|
SupabaseConfiguration({
|
|
|
|
required this.url,
|
2023-07-29 09:46:24 +08:00
|
|
|
required this.anon_key,
|
2023-07-05 20:57:09 +08:00
|
|
|
});
|
2023-05-23 23:55:21 +08:00
|
|
|
|
|
|
|
factory SupabaseConfiguration.fromJson(Map<String, dynamic> json) =>
|
|
|
|
_$SupabaseConfigurationFromJson(json);
|
|
|
|
|
|
|
|
Map<String, dynamic> toJson() => _$SupabaseConfigurationToJson(this);
|
|
|
|
}
|
2023-10-02 17:22:22 +08:00
|
|
|
|
|
|
|
@JsonSerializable()
|
|
|
|
class AppFlowyCloudConfiguration {
|
|
|
|
final String base_url;
|
2023-10-07 09:58:44 +08:00
|
|
|
final String ws_base_url;
|
|
|
|
final String gotrue_url;
|
2023-10-02 17:22:22 +08:00
|
|
|
|
|
|
|
AppFlowyCloudConfiguration({
|
|
|
|
required this.base_url,
|
2023-10-07 09:58:44 +08:00
|
|
|
required this.ws_base_url,
|
|
|
|
required this.gotrue_url,
|
2023-10-02 17:22:22 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
factory AppFlowyCloudConfiguration.fromJson(Map<String, dynamic> json) =>
|
|
|
|
_$AppFlowyCloudConfigurationFromJson(json);
|
|
|
|
|
|
|
|
Map<String, dynamic> toJson() => _$AppFlowyCloudConfigurationToJson(this);
|
|
|
|
}
|