aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib.rs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-11-19 19:00:05 +0000
committertv <tv@krebsco.de>2026-11-19 20:13:16 +0100
commitc66f0f8f7297484e095e02d259c84469b6c42367 (patch)
treebb12683c006ef734689deb0fbe7bad40edc04dc8 /src/lib.rs
parent2a8575ce6562e1579f9c9bd9c9964e3ef36d08f1 (diff)
continuum node-id: a node key's ID, without starting the node
The founders name each node by its ID in the first version, before the federation starts; getting it meant starting a node once with --node-key-create and reading its log. `continuum node-id FILE` prints the node ID of the key FILE holds and exits, `--create` making the key there first where there is none (saying so on standard error). Logs are off for it, as for --print-config: the ID goes to standard output alone.
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 1ac1f35..28d18e5 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -83,6 +83,15 @@ pub async fn run() -> Result<()> {
logging::init();
let config = config::load()?;
+ if let Some((file, create)) = &config.node_id {
+ let new = !file.exists();
+ let key = identity::NodeKey::load(file, *create)?;
+ if new {
+ eprintln!("a new node key in {}: a new node", file.display());
+ }
+ println!("{}", key.id());
+ return Ok(());
+ }
if config.print_only {
println!(
"{}",