From 6d09b81329d33deb7e2ee614aa0c3025555c0f14 Mon Sep 17 00:00:00 2001 From: tv Date: Sun, 25 Oct 2026 20:01:00 +0100 Subject: allow to remake genesis --- src/config/mod.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/config/mod.rs') diff --git a/src/config/mod.rs b/src/config/mod.rs index c56afa6..538689e 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -126,6 +126,13 @@ pub(crate) const OPTIONS: &[OptionSpec] = &[ None, "Start the swarm again from a backup (as GET /admin/document saves it): this node loads it, on the swarm and epoch it names, and is ready at once; other nodes join it. Members of the swarm still running merge with it, or it rejoins them if they moved on to a newer epoch (the backup is then dropped).", ), + option( + "remake", + Kind::Text, + "KIND[:PATH]", + None, + "With --genesis: make the new swarm's document as a remake of this kind would, instead of starting it empty: import:PATH (an Automerge document, e.g. a backup, without its history and protocol data) or replace:PATH (a JSON document, the store root); compact changes nothing.", + ), option( "document-file", Kind::Text, @@ -274,6 +281,7 @@ pub(crate) struct Settings { #[serde(default = "default_document_rewrite_secs")] pub(crate) document_rewrite_secs: u64, pub(crate) recover_from: Option, + pub(crate) remake: Option, #[serde(default)] pub(crate) force: Vec, pub(crate) swarm_key_file: Option, @@ -363,6 +371,9 @@ impl Settings { "genesis starts a new swarm, so there are no seeds to join through; unset seeds (--unset seeds) or genesis" ); } + if self.remake.is_some() && !self.genesis { + bail!("remake makes a new swarm's document; it needs genesis"); + } if self.genesis && self.recover_from.is_some() { bail!("recover-from starts the swarm from a backup; it can't be combined with genesis"); } -- cgit v1.3.1