make ui and engines optional in config

This commit is contained in:
mat 2024-04-27 20:41:56 -05:00
parent 1c2ae52435
commit 878510bcb2

View File

@ -9,11 +9,13 @@ use crate::engines::Engine;
#[derive(Deserialize, Debug)] #[derive(Deserialize, Debug)]
pub struct Config { pub struct Config {
pub bind: SocketAddr, pub bind: SocketAddr,
#[serde(default)]
pub ui: UiConfig, pub ui: UiConfig,
#[serde(default)]
pub engines: EnginesConfig, pub engines: EnginesConfig,
} }
#[derive(Deserialize, Debug)] #[derive(Deserialize, Debug, Default)]
pub struct UiConfig { pub struct UiConfig {
#[serde(default)] #[serde(default)]
pub show_engine_list_separator: Option<bool>, pub show_engine_list_separator: Option<bool>,
@ -21,7 +23,7 @@ pub struct UiConfig {
pub show_version_info: Option<bool>, pub show_version_info: Option<bool>,
} }
#[derive(Deserialize, Debug)] #[derive(Deserialize, Debug, Default)]
pub struct EnginesConfig { pub struct EnginesConfig {
#[serde(flatten)] #[serde(flatten)]
pub map: HashMap<Engine, DefaultableEngineConfig>, pub map: HashMap<Engine, DefaultableEngineConfig>,