Browse Source

master: fix invalid default config for empty client section

ipv6
Denis Drakhnia 7 months ago
parent
commit
311c78a588
  1. 24
      master/src/config.rs

24
master/src/config.rs

@ -125,12 +125,12 @@ impl Default for TimeoutConfig {
#[derive(Deserialize, Debug)] #[derive(Deserialize, Debug)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
pub struct ClientConfig { pub struct ClientConfig {
#[serde(default)] #[serde(default = "default_client_version")]
#[serde(deserialize_with = "deserialize_version")] #[serde(deserialize_with = "deserialize_version")]
pub version: Version, pub version: Version,
#[serde(default)] #[serde(default = "default_client_update_map")]
pub update_map: Box<str>, pub update_map: Box<str>,
#[serde(default)] #[serde(default = "default_client_update_title")]
pub update_title: Box<str>, pub update_title: Box<str>,
#[serde(default)] #[serde(default)]
pub update_addr: Option<Box<str>>, pub update_addr: Option<Box<str>>,
@ -139,9 +139,9 @@ pub struct ClientConfig {
impl Default for ClientConfig { impl Default for ClientConfig {
fn default() -> Self { fn default() -> Self {
Self { Self {
version: Version::new(0, 19), version: default_client_version(),
update_map: String::from("Update please").into_boxed_str(), update_map: default_client_update_map(),
update_title: String::from("https://github.com/FWGS/xash3d-fwgs").into_boxed_str(), update_title: default_client_update_title(),
update_addr: None, update_addr: None,
} }
} }
@ -200,6 +200,18 @@ fn default_server_ip() -> IpAddr {
DEFAULT_MASTER_SERVER_IP DEFAULT_MASTER_SERVER_IP
} }
fn default_client_version() -> Version {
Version::new(0, 19)
}
fn default_client_update_map() -> Box<str> {
Box::from("Update please")
}
fn default_client_update_title() -> Box<str> {
Box::from("https://github.com/FWGS/xash3d-fwgs")
}
fn default_hash_key() -> Box<str> { fn default_hash_key() -> Box<str> {
Box::from(admin::HASH_KEY) Box::from(admin::HASH_KEY)
} }

Loading…
Cancel
Save