diff options
Diffstat (limited to 'src/config/mod.rs')
| -rw-r--r-- | src/config/mod.rs | 33 |
1 files changed, 23 insertions, 10 deletions
diff --git a/src/config/mod.rs b/src/config/mod.rs index 0fee76e..ad88494 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -100,7 +100,14 @@ pub(crate) const OPTIONS: &[OptionSpec] = &[ Kind::List, "STRING,[STRING...]", None, - "How to reach a node of the swarm to join: a Mycelium public key, a Mycelium IPv6 address, or a host name with an AAAA record for one. Without seeds, the node starts a new swarm (genesis).", + "How to reach a node of the swarm to join: a Mycelium public key, a Mycelium IPv6 address, or a host name with an AAAA record for one. A node keeps trying until it has joined.", + ), + option( + "genesis", + 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.", ), option( "swarm-key-file", @@ -213,6 +220,8 @@ pub(crate) struct Settings { pub(crate) debug_api: bool, #[serde(default)] pub(crate) seeds: Vec<String>, + #[serde(default)] + pub(crate) genesis: bool, pub(crate) swarm_key_file: Option<PathBuf>, pub(crate) alias: Option<String>, #[serde(default = "default_keepalive_secs")] @@ -400,15 +409,19 @@ fn unset_entry(provenance: Provenance) -> Entry { /// values from earlier sources (lower precedence), so e.g. `--mycelium-rest-url` on the /// command line overrides `mycelium-key-file` from a file. Both set in one source is an /// error (`Settings::check`). -const CONFLICTS: &[(&[&str], &[&str])] = &[( - &["mycelium-rest-url"], - &[ - "mycelium-key-file", - "mycelium-network-key-file", - "mycelium-network-name", - "mycelium-tcp-listen-port", - ], -)]; +const CONFLICTS: &[(&[&str], &[&str])] = &[ + ( + &["mycelium-rest-url"], + &[ + "mycelium-key-file", + "mycelium-network-key-file", + "mycelium-network-name", + "mycelium-tcp-listen-port", + ], + ), + // A new swarm has nobody to join. + (&["genesis"], &["seeds"]), +]; /// The options `name` can't be combined with. fn conflicting(name: &str) -> impl Iterator<Item = &'static str> + '_ { |
