Skip to content

Commit 4b6c8be

Browse files
committed
config: add a default webserver binding
This is handling default values for old config files without this entry.
1 parent 35b35fc commit 4b6c8be

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/config.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,10 @@ where
8787
}
8888
}
8989

90+
fn webserver_default_bind() -> Option<String> {
91+
Some("0.0.0.0:80".into())
92+
}
93+
9094
#[derive(Debug, Clone, Deserialize, Serialize)]
9195
#[serde(default)]
9296
pub struct AppConfig {
@@ -107,7 +111,10 @@ pub struct AppConfig {
107111
pub btalias: Option<String>,
108112
pub keepalive: bool,
109113
pub timeout_secs: u16,
110-
#[serde(default, deserialize_with = "empty_string_as_none")]
114+
#[serde(
115+
default = "webserver_default_bind",
116+
deserialize_with = "empty_string_as_none"
117+
)]
111118
pub webserver: Option<String>,
112119
pub bt_timeout_secs: u16,
113120
pub mitm: bool,
@@ -144,7 +151,7 @@ impl Default for AppConfig {
144151
btalias: None,
145152
keepalive: false,
146153
timeout_secs: 10,
147-
webserver: Some("0.0.0.0:80".into()),
154+
webserver: webserver_default_bind(),
148155
bt_timeout_secs: 120,
149156
mitm: false,
150157
dpi: 0,

0 commit comments

Comments
 (0)