From 9845a07960fa083db0b0c7e2312f98706e9684cb Mon Sep 17 00:00:00 2001 From: tv Date: Sun, 25 Oct 2026 11:43:53 +0100 Subject: add state file This allows storing the swarm ID and additionally discovered seeds, which prevents a formerly genesis node to start a new document. --- src/config/mod.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/config/mod.rs') diff --git a/src/config/mod.rs b/src/config/mod.rs index 73f4432..b4ea0aa 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -107,7 +107,14 @@ pub(crate) const OPTIONS: &[OptionSpec] = &[ Kind::Flag, "BOOL", Some("false"), - "Start a new swarm, as its genesis node, instead of joining one through seeds. Every start with it starts another new swarm: drop it once the swarm exists, and give the node seeds instead.", + "Start a new swarm, as its genesis node, instead of joining one through seeds. Every start with it starts another new swarm: drop it once the swarm exists, and give the node seeds instead. With a --state-file that remembers a swarm, it starts that swarm again instead (empty; nodes of it still running merge with this one).", + ), + option( + "state-file", + Kind::Text, + "PATH", + None, + "File where this node remembers its swarm across restarts: the swarm ID and some members to rejoin through (not the document). Written once ready, then rarely. Without it, a restarted node knows only its configured seeds.", ), option( "swarm-key-file", @@ -222,6 +229,7 @@ pub(crate) struct Settings { pub(crate) seeds: Vec, #[serde(default)] pub(crate) genesis: bool, + pub(crate) state_file: Option, pub(crate) swarm_key_file: Option, pub(crate) alias: Option, #[serde(default = "default_keepalive_secs")] -- cgit v1.3.1