mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-04-02 05:23:14 +00:00
appmgr: fix lan service deserialization
This commit is contained in:
committed by
Keagan McClelland
parent
2e3e1401f5
commit
c8aafbdbc9
@@ -33,9 +33,18 @@ impl<'de> serde::de::Deserialize<'de> for PortMapping {
|
|||||||
pub struct PortMappingIF {
|
pub struct PortMappingIF {
|
||||||
pub internal: u16,
|
pub internal: u16,
|
||||||
pub tor: u16,
|
pub tor: u16,
|
||||||
#[serde(default)]
|
#[serde(default, deserialize_with = "deserialize_some")]
|
||||||
pub lan: Option<Option<LanOptions>>,
|
pub lan: Option<Option<LanOptions>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn deserialize_some<'de, T, D>(deserializer: D) -> Result<Option<T>, D::Error>
|
||||||
|
where
|
||||||
|
T: serde::de::Deserialize<'de>,
|
||||||
|
D: serde::de::Deserializer<'de>,
|
||||||
|
{
|
||||||
|
serde::de::Deserialize::deserialize(deserializer).map(Some)
|
||||||
|
}
|
||||||
|
|
||||||
let input_format: PortMappingIF = serde::de::Deserialize::deserialize(deserializer)?;
|
let input_format: PortMappingIF = serde::de::Deserialize::deserialize(deserializer)?;
|
||||||
Ok(PortMapping {
|
Ok(PortMapping {
|
||||||
internal: input_format.internal,
|
internal: input_format.internal,
|
||||||
|
|||||||
Reference in New Issue
Block a user