2023-05-21 18:53:59 +08:00
|
|
|
use std::sync::Arc;
|
|
|
|
|
2023-07-05 20:57:09 +08:00
|
|
|
use appflowy_integrate::RemoteCollabStorage;
|
|
|
|
|
|
|
|
use flowy_database2::deps::DatabaseCloudService;
|
|
|
|
use flowy_document2::deps::DocumentCloudService;
|
|
|
|
use flowy_folder2::deps::FolderCloudService;
|
2023-05-21 18:53:59 +08:00
|
|
|
use flowy_user::event_map::UserAuthService;
|
|
|
|
|
|
|
|
use crate::self_host::configuration::SelfHostedConfiguration;
|
2023-05-23 23:55:21 +08:00
|
|
|
use crate::self_host::impls::{
|
2023-07-05 20:57:09 +08:00
|
|
|
SelfHostedDatabaseCloudServiceImpl, SelfHostedDocumentCloudServiceImpl,
|
2023-05-23 23:55:21 +08:00
|
|
|
SelfHostedServerFolderCloudServiceImpl, SelfHostedUserAuthServiceImpl,
|
|
|
|
};
|
2023-05-21 18:53:59 +08:00
|
|
|
use crate::AppFlowyServer;
|
|
|
|
|
|
|
|
pub struct SelfHostServer {
|
|
|
|
pub(crate) config: SelfHostedConfiguration,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl SelfHostServer {
|
|
|
|
pub fn new(config: SelfHostedConfiguration) -> Self {
|
|
|
|
Self { config }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl AppFlowyServer for SelfHostServer {
|
|
|
|
fn user_service(&self) -> Arc<dyn UserAuthService> {
|
|
|
|
Arc::new(SelfHostedUserAuthServiceImpl::new(self.config.clone()))
|
|
|
|
}
|
2023-05-23 23:55:21 +08:00
|
|
|
|
|
|
|
fn folder_service(&self) -> Arc<dyn FolderCloudService> {
|
|
|
|
Arc::new(SelfHostedServerFolderCloudServiceImpl())
|
|
|
|
}
|
2023-07-05 20:57:09 +08:00
|
|
|
|
|
|
|
fn database_service(&self) -> Arc<dyn DatabaseCloudService> {
|
|
|
|
Arc::new(SelfHostedDatabaseCloudServiceImpl())
|
|
|
|
}
|
|
|
|
|
|
|
|
fn document_service(&self) -> Arc<dyn DocumentCloudService> {
|
|
|
|
Arc::new(SelfHostedDocumentCloudServiceImpl())
|
|
|
|
}
|
|
|
|
|
|
|
|
fn collab_storage(&self) -> Option<Arc<dyn RemoteCollabStorage>> {
|
|
|
|
None
|
|
|
|
}
|
2023-05-21 18:53:59 +08:00
|
|
|
}
|