2023-11-05 06:00:24 +00:00
|
|
|
// ignore_for_file: non_constant_identifier_names
|
2023-05-23 15:55:21 +00:00
|
|
|
|
2023-11-05 06:00:24 +00:00
|
|
|
import 'package:json_annotation/json_annotation.dart';
|
|
|
|
part 'backend_env.g.dart';
|
2023-05-23 15:55:21 +00:00
|
|
|
|
|
|
|
@JsonSerializable()
|
2023-11-20 12:54:47 +00:00
|
|
|
class AppFlowyConfiguration {
|
|
|
|
AppFlowyConfiguration({
|
2023-11-28 02:54:31 +00:00
|
|
|
required this.root,
|
2023-11-20 12:54:47 +00:00
|
|
|
required this.custom_app_path,
|
|
|
|
required this.origin_app_path,
|
|
|
|
required this.device_id,
|
2023-11-28 02:54:31 +00:00
|
|
|
required this.authenticator_type,
|
2023-07-14 05:37:13 +00:00
|
|
|
required this.supabase_config,
|
2023-10-02 09:22:22 +00:00
|
|
|
required this.appflowy_cloud_config,
|
2023-11-28 02:54:31 +00:00
|
|
|
required this.envs,
|
2023-07-14 05:37:13 +00:00
|
|
|
});
|
2023-05-23 15:55:21 +00:00
|
|
|
|
2023-11-20 12:54:47 +00:00
|
|
|
factory AppFlowyConfiguration.fromJson(Map<String, dynamic> json) =>
|
|
|
|
_$AppFlowyConfigurationFromJson(json);
|
2023-05-23 15:55:21 +00:00
|
|
|
|
2024-01-25 15:37:36 +00:00
|
|
|
final String root;
|
|
|
|
final String custom_app_path;
|
|
|
|
final String origin_app_path;
|
|
|
|
final String device_id;
|
|
|
|
final int authenticator_type;
|
|
|
|
final SupabaseConfiguration supabase_config;
|
|
|
|
final AppFlowyCloudConfiguration appflowy_cloud_config;
|
|
|
|
final Map<String, String> envs;
|
|
|
|
|
2023-11-20 12:54:47 +00:00
|
|
|
Map<String, dynamic> toJson() => _$AppFlowyConfigurationToJson(this);
|
2023-05-23 15:55:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@JsonSerializable()
|
|
|
|
class SupabaseConfiguration {
|
2023-07-05 12:57:09 +00:00
|
|
|
SupabaseConfiguration({
|
|
|
|
required this.url,
|
2023-07-29 01:46:24 +00:00
|
|
|
required this.anon_key,
|
2023-07-05 12:57:09 +00:00
|
|
|
});
|
2023-05-23 15:55:21 +00:00
|
|
|
|
|
|
|
factory SupabaseConfiguration.fromJson(Map<String, dynamic> json) =>
|
|
|
|
_$SupabaseConfigurationFromJson(json);
|
|
|
|
|
2024-01-25 15:37:36 +00:00
|
|
|
/// Indicates whether the sync feature is enabled.
|
|
|
|
final String url;
|
|
|
|
final String anon_key;
|
|
|
|
|
2023-05-23 15:55:21 +00:00
|
|
|
Map<String, dynamic> toJson() => _$SupabaseConfigurationToJson(this);
|
2023-11-20 12:54:47 +00:00
|
|
|
|
|
|
|
static SupabaseConfiguration defaultConfig() {
|
|
|
|
return SupabaseConfiguration(
|
|
|
|
url: '',
|
|
|
|
anon_key: '',
|
|
|
|
);
|
|
|
|
}
|
2023-11-24 03:54:47 +00:00
|
|
|
|
|
|
|
bool get isValid {
|
|
|
|
return url.isNotEmpty && anon_key.isNotEmpty;
|
|
|
|
}
|
2023-05-23 15:55:21 +00:00
|
|
|
}
|
2023-10-02 09:22:22 +00:00
|
|
|
|
|
|
|
@JsonSerializable()
|
|
|
|
class AppFlowyCloudConfiguration {
|
|
|
|
AppFlowyCloudConfiguration({
|
|
|
|
required this.base_url,
|
2023-10-07 01:58:44 +00:00
|
|
|
required this.ws_base_url,
|
|
|
|
required this.gotrue_url,
|
2023-10-02 09:22:22 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
factory AppFlowyCloudConfiguration.fromJson(Map<String, dynamic> json) =>
|
|
|
|
_$AppFlowyCloudConfigurationFromJson(json);
|
|
|
|
|
2024-01-25 15:37:36 +00:00
|
|
|
final String base_url;
|
|
|
|
final String ws_base_url;
|
|
|
|
final String gotrue_url;
|
|
|
|
|
2023-10-02 09:22:22 +00:00
|
|
|
Map<String, dynamic> toJson() => _$AppFlowyCloudConfigurationToJson(this);
|
2023-11-20 12:54:47 +00:00
|
|
|
|
|
|
|
static AppFlowyCloudConfiguration defaultConfig() {
|
|
|
|
return AppFlowyCloudConfiguration(
|
|
|
|
base_url: '',
|
|
|
|
ws_base_url: '',
|
|
|
|
gotrue_url: '',
|
|
|
|
);
|
|
|
|
}
|
2023-11-24 03:54:47 +00:00
|
|
|
|
|
|
|
bool get isValid {
|
|
|
|
return base_url.isNotEmpty &&
|
|
|
|
ws_base_url.isNotEmpty &&
|
|
|
|
gotrue_url.isNotEmpty;
|
|
|
|
}
|
2023-10-02 09:22:22 +00:00
|
|
|
}
|