radicle: Fix config deserialization
This is a fix for the breaking changes introduced with `PeerConfig`.
This commit is contained in:
parent
14c204a11f
commit
15b50ce6a5
|
|
@ -131,21 +131,29 @@ pub struct Config {
|
||||||
/// Node alias.
|
/// Node alias.
|
||||||
pub alias: Alias,
|
pub alias: Alias,
|
||||||
/// Peer configuration.
|
/// Peer configuration.
|
||||||
|
#[serde(default)]
|
||||||
pub peers: PeerConfig,
|
pub peers: PeerConfig,
|
||||||
/// Peers to connect to on startup.
|
/// Peers to connect to on startup.
|
||||||
/// Connections to these peers will be maintained.
|
/// Connections to these peers will be maintained.
|
||||||
|
#[serde(default)]
|
||||||
pub connect: HashSet<ConnectAddress>,
|
pub connect: HashSet<ConnectAddress>,
|
||||||
/// Specify the node's public addresses
|
/// Specify the node's public addresses
|
||||||
|
#[serde(default)]
|
||||||
pub external_addresses: Vec<Address>,
|
pub external_addresses: Vec<Address>,
|
||||||
/// Peer-to-peer network.
|
/// Peer-to-peer network.
|
||||||
|
#[serde(default)]
|
||||||
pub network: Network,
|
pub network: Network,
|
||||||
/// Whether or not our node should relay inventories.
|
/// Whether or not our node should relay inventories.
|
||||||
|
#[serde(default = "crate::serde_ext::bool::yes")]
|
||||||
pub relay: bool,
|
pub relay: bool,
|
||||||
/// Configured service limits.
|
/// Configured service limits.
|
||||||
|
#[serde(default)]
|
||||||
pub limits: Limits,
|
pub limits: Limits,
|
||||||
/// Default tracking policy.
|
/// Default tracking policy.
|
||||||
|
#[serde(default)]
|
||||||
pub policy: Policy,
|
pub policy: Policy,
|
||||||
/// Default tracking scope.
|
/// Default tracking scope.
|
||||||
|
#[serde(default)]
|
||||||
pub scope: Scope,
|
pub scope: Scope,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,10 @@
|
||||||
|
pub mod bool {
|
||||||
|
/// Function that always returns `true`, for use in `serde(default)` attributes.
|
||||||
|
pub fn yes() -> bool {
|
||||||
|
true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub mod string {
|
pub mod string {
|
||||||
use std::fmt::Display;
|
use std::fmt::Display;
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue