chore: post rebase fixes
This commit is contained in:
parent
42b3cca886
commit
8bf6aff923
|
|
@ -14,6 +14,7 @@ use tracing::{info, warn};
|
||||||
|
|
||||||
use crate::actix_ws::server::RealtimeServerActor;
|
use crate::actix_ws::server::RealtimeServerActor;
|
||||||
use access_control::access::AccessControl;
|
use access_control::access::AccessControl;
|
||||||
|
use appflowy_ai_client::client::AppFlowyAIClient;
|
||||||
use workspace_access::notification::spawn_listen_on_workspace_member_change;
|
use workspace_access::notification::spawn_listen_on_workspace_member_change;
|
||||||
use workspace_access::WorkspaceAccessControlImpl;
|
use workspace_access::WorkspaceAccessControlImpl;
|
||||||
|
|
||||||
|
|
@ -26,6 +27,7 @@ use crate::collab::notification::spawn_listen_on_collab_member_change;
|
||||||
use crate::collab::storage::CollabStorageImpl;
|
use crate::collab::storage::CollabStorageImpl;
|
||||||
use crate::command::{CLCommandReceiver, CLCommandSender};
|
use crate::command::{CLCommandReceiver, CLCommandSender};
|
||||||
use crate::config::{Config, DatabaseSetting};
|
use crate::config::{Config, DatabaseSetting};
|
||||||
|
use crate::indexer::IndexerProvider;
|
||||||
use crate::pg_listener::PgListeners;
|
use crate::pg_listener::PgListeners;
|
||||||
use crate::shared_state::RealtimeSharedState;
|
use crate::shared_state::RealtimeSharedState;
|
||||||
use crate::snapshot::SnapshotControl;
|
use crate::snapshot::SnapshotControl;
|
||||||
|
|
@ -76,6 +78,7 @@ pub async fn run_actix_server(
|
||||||
Duration::from_secs(config.collab.group_persistence_interval_secs),
|
Duration::from_secs(config.collab.group_persistence_interval_secs),
|
||||||
config.collab.edit_state_max_count,
|
config.collab.edit_state_max_count,
|
||||||
config.collab.edit_state_max_secs,
|
config.collab.edit_state_max_secs,
|
||||||
|
state.indexer_provider.clone(),
|
||||||
)
|
)
|
||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
@ -96,6 +99,8 @@ pub async fn run_actix_server(
|
||||||
pub async fn init_state(config: &Config, rt_cmd_tx: CLCommandSender) -> Result<AppState, Error> {
|
pub async fn init_state(config: &Config, rt_cmd_tx: CLCommandSender) -> Result<AppState, Error> {
|
||||||
let metrics = AppMetrics::new();
|
let metrics = AppMetrics::new();
|
||||||
let pg_pool = get_connection_pool(&config.db_settings).await?;
|
let pg_pool = get_connection_pool(&config.db_settings).await?;
|
||||||
|
let ai_client = AppFlowyAIClient::new(&config.ai.url());
|
||||||
|
let indexer_provider = IndexerProvider::new(pg_pool.clone(), ai_client);
|
||||||
|
|
||||||
// User cache
|
// User cache
|
||||||
let user_cache = UserCache::new(pg_pool.clone()).await;
|
let user_cache = UserCache::new(pg_pool.clone()).await;
|
||||||
|
|
@ -154,6 +159,7 @@ pub async fn init_state(config: &Config, rt_cmd_tx: CLCommandSender) -> Result<A
|
||||||
collab_access_control_storage: collab_storage,
|
collab_access_control_storage: collab_storage,
|
||||||
metrics,
|
metrics,
|
||||||
realtime_shared_state,
|
realtime_shared_state,
|
||||||
|
indexer_provider,
|
||||||
};
|
};
|
||||||
Ok(app_state)
|
Ok(app_state)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@ pub struct Config {
|
||||||
pub gotrue: GoTrueSetting,
|
pub gotrue: GoTrueSetting,
|
||||||
pub collab: CollabSetting,
|
pub collab: CollabSetting,
|
||||||
pub redis_uri: Secret<String>,
|
pub redis_uri: Secret<String>,
|
||||||
|
pub ai: AISettings,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
|
|
@ -21,6 +22,18 @@ pub struct ApplicationSetting {
|
||||||
pub host: String,
|
pub host: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
|
pub struct AISettings {
|
||||||
|
pub port: u16,
|
||||||
|
pub host: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl AISettings {
|
||||||
|
pub fn url(&self) -> String {
|
||||||
|
format!("http://{}:{}", self.host, self.port)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct WebsocketSetting {
|
pub struct WebsocketSetting {
|
||||||
pub heartbeat_interval: u8,
|
pub heartbeat_interval: u8,
|
||||||
|
|
@ -118,6 +131,10 @@ pub fn get_configuration() -> Result<Config, anyhow::Error> {
|
||||||
edit_state_max_secs: get_env_var("APPFLOWY_COLLAB_EDIT_STATE_MAX_SECS", "60").parse()?,
|
edit_state_max_secs: get_env_var("APPFLOWY_COLLAB_EDIT_STATE_MAX_SECS", "60").parse()?,
|
||||||
},
|
},
|
||||||
redis_uri: get_env_var("APPFLOWY_REDIS_URI", "redis://localhost:6379").into(),
|
redis_uri: get_env_var("APPFLOWY_REDIS_URI", "redis://localhost:6379").into(),
|
||||||
|
ai: AISettings {
|
||||||
|
port: get_env_var("APPFLOWY_AI_SERVER_PORT", "5001").parse()?,
|
||||||
|
host: get_env_var("APPFLOWY_AI_SERVER_HOST", "localhost"),
|
||||||
|
},
|
||||||
};
|
};
|
||||||
Ok(config)
|
Ok(config)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ use database::user::{select_all_uid_uuid, select_uid_from_uuid};
|
||||||
|
|
||||||
use crate::collab::storage::CollabAccessControlStorage;
|
use crate::collab::storage::CollabAccessControlStorage;
|
||||||
use crate::config::Config;
|
use crate::config::Config;
|
||||||
|
use crate::indexer::IndexerProvider;
|
||||||
use crate::metrics::CollabMetrics;
|
use crate::metrics::CollabMetrics;
|
||||||
use crate::pg_listener::PgListeners;
|
use crate::pg_listener::PgListeners;
|
||||||
use crate::shared_state::RealtimeSharedState;
|
use crate::shared_state::RealtimeSharedState;
|
||||||
|
|
@ -29,6 +30,7 @@ pub struct AppState {
|
||||||
pub collab_access_control_storage: Arc<CollabAccessControlStorage>,
|
pub collab_access_control_storage: Arc<CollabAccessControlStorage>,
|
||||||
pub metrics: AppMetrics,
|
pub metrics: AppMetrics,
|
||||||
pub realtime_shared_state: RealtimeSharedState,
|
pub realtime_shared_state: RealtimeSharedState,
|
||||||
|
pub indexer_provider: Arc<IndexerProvider>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue