diff options
| author | tv <tv@krebsco.de> | 2026-11-02 22:05:50 +0100 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-11-02 22:05:50 +0100 |
| commit | df314df4793765ea5334ac75b97d415286cc7fa3 (patch) | |
| tree | 1ed6c10c066fc5b273c7cf04a1b341e70e38c4a8 /src/config/mod.rs | |
| parent | 627efc3b2620d75fcf2deab170187ba2e082417c (diff) | |
dashboard: double-click opens peer dashboard
Diffstat (limited to 'src/config/mod.rs')
| -rw-r--r-- | src/config/mod.rs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/config/mod.rs b/src/config/mod.rs index 37c010e..527dced 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -243,6 +243,13 @@ pub(crate) const OPTIONS: &[OptionSpec] = &[ "A name for this node, shown next to its node ID (/peers, metrics). Published in the swarm's member list; not unique, never an identity.", ), option( + "dashboard-url", + Kind::Text, + "URL", + None, + "Where people reach this node's dashboard (http:// or https://, e.g. behind a reverse proxy). Published in the swarm's member list: the other nodes' dashboards open it on a double-click on this node.", + ), + option( "keepalive", Kind::Duration, "DURATION", @@ -537,6 +544,7 @@ pub(crate) struct Settings { #[serde(default)] pub(crate) swarm_key_create: bool, pub(crate) alias: Option<String>, + pub(crate) dashboard_url: Option<String>, #[serde(default = "default_keepalive", with = "crate::units::duration_option")] pub(crate) keepalive: Duration, #[serde( @@ -788,6 +796,17 @@ impl Settings { if let Some(alias) = &self.alias { check_alias(alias)?; } + if let Some(url) = &self.dashboard_url { + let scheme = url.starts_with("http://") || url.starts_with("https://"); + if !scheme + || url.len() > 2048 + || url.chars().any(|c| c.is_whitespace() || c.is_control()) + { + bail!( + "dashboard-url: {url:?} is no http:// or https:// URL (of at most 2048 characters)" + ); + } + } Ok(()) } } @@ -842,6 +861,7 @@ impl Settings { ("swarm-key-create", self.swarm_key_create), ("protocol-writers", !self.protocol_writers.is_empty()), ("alias", self.alias.is_some()), + ("dashboard-url", self.dashboard_url.is_some()), ("debug-api", self.debug_api), ]; let set: Vec<&str> = swarm_options |
