forked from lavina/lavina
core: add configuration for clustering
This commit is contained in:
parent
cefd6f8df0
commit
a132715024
|
@ -12,3 +12,9 @@ key = "./certs/xmpp.key"
|
||||||
|
|
||||||
[storage]
|
[storage]
|
||||||
db_path = "db.sqlite"
|
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"]
|
||||||
|
|
|
@ -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]>,
|
||||||
|
}
|
|
@ -4,5 +4,6 @@ pub mod prelude;
|
||||||
pub mod repo;
|
pub mod repo;
|
||||||
pub mod room;
|
pub mod room;
|
||||||
pub mod terminator;
|
pub mod terminator;
|
||||||
|
pub mod clustering;
|
||||||
|
|
||||||
mod table;
|
mod table;
|
||||||
|
|
|
@ -20,6 +20,7 @@ struct ServerConfig {
|
||||||
irc: projection_irc::ServerConfig,
|
irc: projection_irc::ServerConfig,
|
||||||
xmpp: projection_xmpp::ServerConfig,
|
xmpp: projection_xmpp::ServerConfig,
|
||||||
storage: lavina_core::repo::StorageConfig,
|
storage: lavina_core::repo::StorageConfig,
|
||||||
|
clustering: lavina_core::clustering::ClusteringConfig,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Parser)]
|
#[derive(Parser)]
|
||||||
|
@ -48,6 +49,7 @@ async fn main() -> Result<()> {
|
||||||
irc: irc_config,
|
irc: irc_config,
|
||||||
xmpp: xmpp_config,
|
xmpp: xmpp_config,
|
||||||
storage: storage_config,
|
storage: storage_config,
|
||||||
|
clustering: clustering_config,
|
||||||
} = config;
|
} = config;
|
||||||
let mut metrics = MetricsRegistry::new();
|
let mut metrics = MetricsRegistry::new();
|
||||||
let storage = Storage::open(storage_config).await?;
|
let storage = Storage::open(storage_config).await?;
|
||||||
|
|
Loading…
Reference in New Issue