modules: [modules] config + example service crate + SDK guide
A [modules] block selects which services start (default: NickServ + ChanServ); main.rs constructs each compiled-in module only when named, so a node can run a subset and optional modules ship dormant. Add fedserv-example, a minimal read-only Service that depends on fedserv-api alone -- the template a new pseudo-client is copied from, enabled by adding "example" to the config. MODULES.md documents writing and registering a service or protocol module.
This commit is contained in:
parent
596630df53
commit
e0bb3a1fea
9 changed files with 254 additions and 7 deletions
|
|
@ -16,6 +16,28 @@ pub struct Config {
|
|||
// directory. Absent = the RPC server does not start.
|
||||
#[serde(default)]
|
||||
pub grpc: Option<Grpc>,
|
||||
// Which service modules to start. Absent = the built-in NickServ + ChanServ.
|
||||
#[serde(default)]
|
||||
pub modules: Modules,
|
||||
}
|
||||
|
||||
// The service modules to bring up at burst. Each name maps to a compiled-in
|
||||
// module crate the daemon knows how to construct (see main.rs). Names not built
|
||||
// in are ignored.
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub struct Modules {
|
||||
#[serde(default = "default_services")]
|
||||
pub services: Vec<String>,
|
||||
}
|
||||
|
||||
impl Default for Modules {
|
||||
fn default() -> Self {
|
||||
Modules { services: default_services() }
|
||||
}
|
||||
}
|
||||
|
||||
fn default_services() -> Vec<String> {
|
||||
vec!["nickserv".to_string(), "chanserv".to_string()]
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize, Clone)]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue