radicle/explorer: Allow overriding default URL
This makes the default Radicle Explorer URL configurable at compile-time via the environment variable `RADICLE_EXPLORER`. In order to stay backwards compatible, we still default to "app.radicle.xyz"
This commit is contained in:
parent
e2c476a387
commit
1a3fda547a
|
|
@ -80,7 +80,7 @@ impl std::fmt::Display for ExplorerUrl {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A public explorer, eg. `https://app.radicle.xyz`.
|
/// A public explorer.
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
|
#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
|
||||||
#[serde(transparent)]
|
#[serde(transparent)]
|
||||||
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
|
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
|
||||||
|
|
@ -89,7 +89,8 @@ pub struct Explorer(String);
|
||||||
impl Default for Explorer {
|
impl Default for Explorer {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self(String::from(
|
Self(String::from(
|
||||||
"https://app.radicle.xyz/nodes/$host/$rid$path",
|
std::option_env!("RADICLE_EXPLORER")
|
||||||
|
.unwrap_or("https://app.radicle.xyz/nodes/$host/$rid$path"),
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue