From 71e9db99356f861424db6a3bb6eb1fc785a1e776 Mon Sep 17 00:00:00 2001 From: Felix Ableitner Date: Tue, 29 Oct 2024 09:35:44 +0100 Subject: [PATCH] Throw error in case of invalid config value --- src/backend/config.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/backend/config.rs b/src/backend/config.rs index 5e48236..3f51ccf 100644 --- a/src/backend/config.rs +++ b/src/backend/config.rs @@ -6,6 +6,7 @@ use smart_default::SmartDefault; #[derive(Debug, Deserialize, PartialEq, Eq, Clone, Document, SmartDefault)] #[serde(default)] +#[serde(deny_unknown_fields)] pub struct IbisConfig { /// Details about the PostgreSQL database connection pub database: IbisConfigDatabase, @@ -32,6 +33,7 @@ impl IbisConfig { #[derive(Debug, Deserialize, PartialEq, Eq, Clone, Document, SmartDefault)] #[serde(default)] +#[serde(deny_unknown_fields)] pub struct IbisConfigDatabase { /// Database connection url #[default("postgres://ibis:password@localhost:5432/ibis")] @@ -45,6 +47,7 @@ pub struct IbisConfigDatabase { #[derive(Debug, Deserialize, PartialEq, Eq, Clone, Document, SmartDefault)] #[serde(default)] +#[serde(deny_unknown_fields)] pub struct IbisConfigSetup { #[default("ibis")] #[doku(example = "ibis")] @@ -56,6 +59,7 @@ pub struct IbisConfigSetup { #[derive(Debug, Deserialize, PartialEq, Eq, Clone, Document, SmartDefault)] #[serde(default)] +#[serde(deny_unknown_fields)] pub struct IbisConfigFederation { /// Domain name of the instance, mandatory for federation #[default("example.com")]