Skip to content

Commit 2dd33fa

Browse files
committed
add deny_unknown_fields to config structs
1 parent 2087b3f commit 2dd33fa

File tree

5 files changed

+7
-0
lines changed

5 files changed

+7
-0
lines changed

src/api.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ fn default_asn_dns_zone() -> Option<String> {
3333
}
3434

3535
#[derive(Debug, Clone, Deserialize)]
36+
#[serde(deny_unknown_fields)]
3637
pub struct ApiServerConfig {
3738
bind: SocketAddr,
3839
#[serde(default)]

src/bgp_collector.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ pub async fn run_peer(
9696
}
9797

9898
#[derive(Debug, Clone, Deserialize)]
99+
#[serde(deny_unknown_fields)]
99100
pub struct PeerConfig {
100101
pub asn: u32,
101102
pub router_id: Ipv4Addr,
@@ -107,6 +108,7 @@ pub struct PeerConfig {
107108
}
108109

109110
#[derive(Debug, Clone, Deserialize)]
111+
#[serde(deny_unknown_fields)]
110112
pub struct BgpCollectorConfig {
111113
pub bind: SocketAddr,
112114
#[serde(default)]

src/bmp_collector.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,11 +210,13 @@ pub async fn run_client(
210210
}
211211

212212
#[derive(Debug, Clone, Deserialize)]
213+
#[serde(deny_unknown_fields)]
213214
pub struct PeerConfig {
214215
pub name_override: Option<String>,
215216
}
216217

217218
#[derive(Debug, Clone, Deserialize)]
219+
#[serde(deny_unknown_fields)]
218220
pub struct BmpCollectorConfig {
219221
pub bind: SocketAddr,
220222
#[serde(default)]

src/bmp_relay.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ use zettabgp::bmp::prelude::*;
1919
use zettabgp::prelude::*;
2020

2121
#[derive(Debug, Deserialize)]
22+
#[serde(deny_unknown_fields)]
2223
pub struct RelayConfig {
2324
table: TableSelector,
2425

src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ pub enum CollectorConfig {
3737
}
3838

3939
#[derive(Deserialize, Debug)]
40+
#[serde(deny_unknown_fields)]
4041
pub struct Config {
4142
pub collectors: HashMap<String, CollectorConfig>,
4243
pub api: api::ApiServerConfig,

0 commit comments

Comments
 (0)