From 79b0ad05535da9c36437cb71df744d0ac6b4986b Mon Sep 17 00:00:00 2001 From: Zhaofeng Li Date: Thu, 21 Nov 2024 13:29:00 -0700 Subject: [PATCH] server/config: Allow omitting database section entirely --- server/src/config.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/server/src/config.rs b/server/src/config.rs index 11e1f8d..3c04dd9 100644 --- a/server/src/config.rs +++ b/server/src/config.rs @@ -105,6 +105,7 @@ pub struct Config { pub require_proof_of_possession: bool, /// Database connection. + #[serde(default = "Default::default")] pub database: DatabaseConfig, /// Storage. @@ -418,6 +419,15 @@ fn load_database_url_from_env() -> String { )) } +impl Default for DatabaseConfig { + fn default() -> Self { + Self { + url: load_database_url_from_env(), + heartbeat: default_db_heartbeat(), + } + } +} + impl Default for JWTConfig { fn default() -> Self { Self {