aboutsummaryrefslogtreecommitdiffstats
path: root/src/config/mod.rs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-10-25 11:43:53 +0100
committertv <tv@krebsco.de>2026-10-25 11:43:53 +0100
commit8886bc09a05b0fb2dc3c84e4b0c816fe81851e14 (patch)
tree6eb6b96dddfc4e31f599a0270a050196af1cf50e /src/config/mod.rs
parent38f3ef952cf4cdd7cf5e9acbc8d9b64eeca86d81 (diff)
add state file
This allows storing the swarm ID and additionally discovered seeds, which prevents a formerly genesis node to start a new document.
Diffstat (limited to 'src/config/mod.rs')
-rw-r--r--src/config/mod.rs10
1 files changed, 9 insertions, 1 deletions
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<String>,
#[serde(default)]
pub(crate) genesis: bool,
+ pub(crate) state_file: Option<PathBuf>,
pub(crate) swarm_key_file: Option<PathBuf>,
pub(crate) alias: Option<String>,
#[serde(default = "default_keepalive_secs")]