diff --git a/config.toml b/config.toml index 6104dce..84fe4ea 100644 --- a/config.toml +++ b/config.toml @@ -12,3 +12,9 @@ key = "./certs/xmpp.key" [storage] db_path = "db.sqlite" + +[clustering] +self_id = 1 +listen_on = "0.0.0.0:23732" +advertised_address = "127.0.0.1:23732" +bootstrap_via = ["0.0.0.0:23733"] diff --git a/crates/lavina-core/src/clustering/mod.rs b/crates/lavina-core/src/clustering/mod.rs new file mode 100644 index 0000000..96650b2 --- /dev/null +++ b/crates/lavina-core/src/clustering/mod.rs @@ -0,0 +1,11 @@ +use std::net::SocketAddr; + +use serde::Deserialize; + +#[derive(Deserialize, Debug, Clone)] +pub struct ClusteringConfig { + pub self_id: u32, + pub listen_on: SocketAddr, + pub advertised_address: SocketAddr, + pub bootstrap_via: Box<[SocketAddr]>, +} diff --git a/crates/lavina-core/src/lib.rs b/crates/lavina-core/src/lib.rs index 401e49e..e9ea057 100644 --- a/crates/lavina-core/src/lib.rs +++ b/crates/lavina-core/src/lib.rs @@ -4,5 +4,6 @@ pub mod prelude; pub mod repo; pub mod room; pub mod terminator; +pub mod clustering; mod table; diff --git a/src/main.rs b/src/main.rs index 53d7c21..0bcc612 100644 --- a/src/main.rs +++ b/src/main.rs @@ -20,6 +20,7 @@ struct ServerConfig { irc: projection_irc::ServerConfig, xmpp: projection_xmpp::ServerConfig, storage: lavina_core::repo::StorageConfig, + clustering: lavina_core::clustering::ClusteringConfig, } #[derive(Parser)] @@ -48,6 +49,7 @@ async fn main() -> Result<()> { irc: irc_config, xmpp: xmpp_config, storage: storage_config, + clustering: clustering_config, } = config; let mut metrics = MetricsRegistry::new(); let storage = Storage::open(storage_config).await?;