From eae1e4db7c787209bcd38dc794c7727aa4cfcb5e Mon Sep 17 00:00:00 2001 From: DhananjayPurohit Date: Thu, 18 Apr 2024 18:04:49 +0530 Subject: [PATCH] fix: mercury server build failure --- server/src/server_config.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/server/src/server_config.rs b/server/src/server_config.rs index bac5462a..da96c701 100644 --- a/server/src/server_config.rs +++ b/server/src/server_config.rs @@ -52,6 +52,11 @@ impl ServerConfig { // Override with settings in file Rocket.toml if exists conf_rs.merge(File::with_name("Rocket").required(false)); + let settings = ConfigRs::builder() + .add_source(File::with_name("Settings")) + .build() + .unwrap(); + // Function to fetch a setting from the environment or fallback to the config file let get_env_or_config = |key: &str, env_var: &str| -> String { env::var(env_var).unwrap_or_else(|_| settings.get_string(key).unwrap()) @@ -63,7 +68,7 @@ impl ServerConfig { lockheight_init: get_env_or_config("lockheight_init", "LOCKHEIGHT_INIT").parse::().unwrap(), lh_decrement: get_env_or_config("lh_decrement", "LH_DECREMENT").parse::().unwrap(), connection_string: get_env_or_config("connection_string", "DATABASE_CONNECTION_STRING"), - } + }; conf_rs.try_into().unwrap() } } \ No newline at end of file