diff options
Diffstat (limited to 'src/config/model.rs')
| -rw-r--r-- | src/config/model.rs | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/config/model.rs b/src/config/model.rs index c36150f6..528a940c 100644 --- a/src/config/model.rs +++ b/src/config/model.rs @@ -30,17 +30,26 @@ impl UpdateChannelConfig { #[derive(Debug, Clone, Copy, Deserialize)] #[serde(default)] pub struct UpdateConfig { + #[serde(default = "default_update_channel")] pub channel: UpdateChannelConfig, } impl Default for UpdateConfig { fn default() -> Self { Self { - channel: UpdateChannelConfig::Stable, + channel: default_update_channel(), } } } +fn default_update_channel() -> UpdateChannelConfig { + if cfg!(windows) { + UpdateChannelConfig::Preview + } else { + UpdateChannelConfig::Stable + } +} + #[derive(Debug, Clone, Copy, PartialEq, Eq, Deserialize, Serialize, Default)] #[serde(rename_all = "lowercase")] pub enum ToastDelivery { @@ -714,9 +723,9 @@ mod tests { use super::*; #[test] - fn update_channel_defaults_stable_and_parses() { + fn update_channel_defaults_for_platform_and_parses() { let default_config = Config::default(); - assert_eq!(default_config.update.channel, UpdateChannelConfig::Stable); + assert_eq!(default_config.update.channel, default_update_channel()); let toml = r#" [update] |
