Skip to content
This repository has been archived by the owner on Apr 29, 2024. It is now read-only.

Commit

Permalink
radicle: Fix config deserialization
Browse files Browse the repository at this point in the history
This is a fix for the breaking changes introduced with `PeerConfig`.
  • Loading branch information
cloudhead committed Aug 14, 2023
1 parent 14c204a commit 15b50ce
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
8 changes: 8 additions & 0 deletions radicle/src/node/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,21 +131,29 @@ pub struct Config {
/// Node alias.
pub alias: Alias,
/// Peer configuration.
#[serde(default)]
pub peers: PeerConfig,
/// Peers to connect to on startup.
/// Connections to these peers will be maintained.
#[serde(default)]
pub connect: HashSet<ConnectAddress>,
/// Specify the node's public addresses
#[serde(default)]
pub external_addresses: Vec<Address>,
/// Peer-to-peer network.
#[serde(default)]
pub network: Network,
/// Whether or not our node should relay inventories.
#[serde(default = "crate::serde_ext::bool::yes")]
pub relay: bool,
/// Configured service limits.
#[serde(default)]
pub limits: Limits,
/// Default tracking policy.
#[serde(default)]
pub policy: Policy,
/// Default tracking scope.
#[serde(default)]
pub scope: Scope,
}

Expand Down
7 changes: 7 additions & 0 deletions radicle/src/serde_ext.rs
Original file line number Diff line number Diff line change
@@ -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 {
use std::fmt::Display;
use std::str::FromStr;
Expand Down

0 comments on commit 15b50ce

Please sign in to comment.