fix failure on missing value that has default

This commit is contained in:
Dominic 2023-04-05 14:08:39 +02:00
parent 47c2c003d1
commit c88b1e2187
Signed by: msrd0
GPG key ID: DCC8C247452E98F9

View file

@ -11,8 +11,12 @@ use std::{
#[serde(deny_unknown_fields)]
pub struct Os {
pub alpine: Alpine,
#[serde(default)]
pub rpi: Rpi,
pub host: Host,
pub user: Vec<User>
}
@ -172,6 +176,15 @@ pub struct Rpi {
pub usercfg: String
}
impl Default for Rpi {
fn default() -> Self {
Self {
cmdline: default_cmdline(),
usercfg: default_usercfg()
}
}
}
fn default_hostname() -> String {
"alpi".into()
}