diff options
Diffstat (limited to 'src/config')
| -rw-r--r-- | src/config/mod.rs | 11 |
1 files changed, 11 insertions, 0 deletions
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 @@ -127,6 +127,13 @@ pub(crate) const OPTIONS: &[OptionSpec] = &[ "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, "PATH", @@ -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<PathBuf>, + pub(crate) remake: Option<String>, #[serde(default)] pub(crate) force: Vec<String>, pub(crate) swarm_key_file: Option<PathBuf>, @@ -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"); } |
