echo/modules/operserv/src/rehash.rs
Jean 64b675e61f
All checks were successful
CI / check (push) Successful in 3m54s
operserv: REHASH reloads config live without a restart
2026-07-17 10:46:12 +00:00

15 lines
756 B
Rust

use echo_api::{Priv, Sender, ServiceCtx};
// REHASH: re-read config.toml and apply the settings that are safe to change
// while linked (opers, standard-replies, services channel, service oper-type,
// expiry, session limits) without restarting — so no relink and no user
// disruption. Admin-only. Server identity, service umodes and the keycard
// endpoint still need a RESTART. The engine does the re-read off the command
// path and notices the outcome (or a parse error, keeping the old config).
pub fn handle(me: &str, from: &Sender, ctx: &mut ServiceCtx) {
if !from.privs.has(Priv::Admin) {
ctx.notice(me, from.uid, "Access denied — REHASH needs the \x02admin\x02 privilege.");
return;
}
ctx.rehash(me, from.uid);
}