Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
options: InstallerOptions {
bootdisk: BootdiskOptions::defaults_from(&runtime_info.disks[0]),
timezone: TimezoneOptions::defaults_from(&runtime_info, &locales),
- password: PasswordOptions::default(),
+ password: PasswordOptions::defaults_from(&runtime_info),
network: NetworkOptions::from(&runtime_info.network),
reboot: false,
},
pub root_password: String,
}
-impl Default for PasswordOptions {
- fn default() -> Self {
+impl PasswordOptions {
+ pub fn defaults_from(info: &RuntimeInfo) -> Self {
+ let domain = info
+ .network
+ .dns
+ .domain
+ .clone()
+ // Safety: The provided default domain will always be valid.
+ .unwrap_or_else(|| Fqdn::from("example.invalid").unwrap());
+
Self {
- email: "mail@example.invalid".to_owned(),
+ email: format!("mail@{domain}"),
root_password: String::new(),
}
}