Skip to content

Commit 9504508

Browse files
fix: implement default trait for Global struct and remove redundant Default derive, so that health server starts with port 8080 instead of 0 which makes it random.
- Removed the Default derive from the Global struct and implemented a custom default method. - The new default method initializes the struct with default values for contracts, etherscan_api_key, and health_port. This fixes that by using the default health port
1 parent 705a517 commit 9504508

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

core/src/manifest/global.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ pub fn default_health_port() -> u16 {
66
8080
77
}
88

9-
#[derive(Debug, Serialize, Deserialize, Default, Clone)]
9+
#[derive(Debug, Serialize, Deserialize, Clone)]
1010
pub struct Global {
1111
#[serde(skip_serializing_if = "Option::is_none")]
1212
pub contracts: Option<Vec<Contract>>,
@@ -17,3 +17,9 @@ pub struct Global {
1717
#[serde(default = "default_health_port")]
1818
pub health_port: u16,
1919
}
20+
21+
impl Default for Global {
22+
fn default() -> Self {
23+
Self { contracts: None, etherscan_api_key: None, health_port: default_health_port() }
24+
}
25+
}

0 commit comments

Comments
 (0)