forked from lavina/lavina
1
0
Fork 0

core: add configuration for clustering

This commit is contained in:
Nikita Vilunov 2023-12-08 15:13:34 +01:00
parent cefd6f8df0
commit a132715024
4 changed files with 20 additions and 0 deletions

View File

@ -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"]

View File

@ -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]>,
}

View File

@ -4,5 +4,6 @@ pub mod prelude;
pub mod repo;
pub mod room;
pub mod terminator;
pub mod clustering;
mod table;

View File

@ -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?;