| 
									
										
										
										
											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() | 
					
						
							| 
									
										
										
										
											2023-11-20 20:54:47 +08:00
										 |  |  | class AppFlowyConfiguration { | 
					
						
							| 
									
										
										
										
											2023-11-27 18:54:31 -08:00
										 |  |  |   final String root; | 
					
						
							| 
									
										
										
										
											2023-11-20 20:54:47 +08:00
										 |  |  |   final String custom_app_path; | 
					
						
							|  |  |  |   final String origin_app_path; | 
					
						
							|  |  |  |   final String device_id; | 
					
						
							| 
									
										
										
										
											2023-11-27 18:54:31 -08:00
										 |  |  |   final int authenticator_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-11-27 18:54:31 -08:00
										 |  |  |   final Map<String, String> envs; | 
					
						
							| 
									
										
										
										
											2023-05-23 23:55:21 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-11-20 20:54:47 +08:00
										 |  |  |   AppFlowyConfiguration({ | 
					
						
							| 
									
										
										
										
											2023-11-27 18:54:31 -08:00
										 |  |  |     required this.root, | 
					
						
							| 
									
										
										
										
											2023-11-20 20:54:47 +08:00
										 |  |  |     required this.custom_app_path, | 
					
						
							|  |  |  |     required this.origin_app_path, | 
					
						
							|  |  |  |     required this.device_id, | 
					
						
							| 
									
										
										
										
											2023-11-27 18:54:31 -08:00
										 |  |  |     required this.authenticator_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-11-27 18:54:31 -08:00
										 |  |  |     required this.envs, | 
					
						
							| 
									
										
										
										
											2023-07-14 13:37:13 +08:00
										 |  |  |   }); | 
					
						
							| 
									
										
										
										
											2023-05-23 23:55:21 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-11-20 20:54:47 +08:00
										 |  |  |   factory AppFlowyConfiguration.fromJson(Map<String, dynamic> json) => | 
					
						
							|  |  |  |       _$AppFlowyConfigurationFromJson(json); | 
					
						
							| 
									
										
										
										
											2023-05-23 23:55:21 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-11-20 20:54:47 +08:00
										 |  |  |   Map<String, dynamic> toJson() => _$AppFlowyConfigurationToJson(this); | 
					
						
							| 
									
										
										
										
											2023-05-23 23:55:21 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | @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-11-20 20:54:47 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |   static SupabaseConfiguration defaultConfig() { | 
					
						
							|  |  |  |     return SupabaseConfiguration( | 
					
						
							|  |  |  |       url: '', | 
					
						
							|  |  |  |       anon_key: '', | 
					
						
							|  |  |  |     ); | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2023-11-24 11:54:47 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |   bool get isValid { | 
					
						
							|  |  |  |     return url.isNotEmpty && anon_key.isNotEmpty; | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2023-05-23 23:55:21 +08:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											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); | 
					
						
							| 
									
										
										
										
											2023-11-20 20:54:47 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |   static AppFlowyCloudConfiguration defaultConfig() { | 
					
						
							|  |  |  |     return AppFlowyCloudConfiguration( | 
					
						
							|  |  |  |       base_url: '', | 
					
						
							|  |  |  |       ws_base_url: '', | 
					
						
							|  |  |  |       gotrue_url: '', | 
					
						
							|  |  |  |     ); | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2023-11-24 11:54:47 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |   bool get isValid { | 
					
						
							|  |  |  |     return base_url.isNotEmpty && | 
					
						
							|  |  |  |         ws_base_url.isNotEmpty && | 
					
						
							|  |  |  |         gotrue_url.isNotEmpty; | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2023-10-02 17:22:22 +08:00
										 |  |  | } |