Skip to content

Commit 69c4b09

Browse files
committed
Make auth method optional
1 parent 8ab2d8e commit 69c4b09

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

src/config.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,11 @@ use std::fmt::{Debug, Formatter};
33
use std::fs::File;
44
use std::io::Read;
55

6-
#[derive(Default, Debug, Deserialize, Serialize)]
6+
#[derive(Debug, Deserialize, Serialize)]
77
pub enum AuthMethod {
88
None,
99
WEP,
1010
WPA,
11-
#[default]
1211
WPA2Personal,
1312
WPAWPA2Personal,
1413
WPA2Enterprise,
@@ -20,7 +19,7 @@ pub enum AuthMethod {
2019
#[derive(Deserialize)]
2120
pub struct Wifi {
2221
pub ssid: String,
23-
pub auth_method: AuthMethod,
22+
pub auth_method: Option<AuthMethod>,
2423
// TODO: provide a default way of not storing plaintext? while the key is probably going to
2524
// be in the repo or somewhere, but at least they need to know in order to decode?
2625
pub password: Option<String>,

src/main.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ async fn run_async(spawner: LocalSpawner) -> Result<(), anyhow::Error> {
8484
&WifiConfig {
8585
ssid: config.wifi.ssid.clone(),
8686
password: config.wifi.password.clone(),
87-
auth_method: Some(AuthMethod::from(&config.wifi.auth_method)),
87+
auth_method: config.wifi.auth_method.as_ref().map(AuthMethod::from),
8888
},
8989
peripherals.modem,
9090
)?;

0 commit comments

Comments
 (0)