put tls behind feature flag

This commit is contained in:
Evan Feenstra
2023-08-25 08:51:50 -07:00
parent 7562fc3cfa
commit a8259973c6
3 changed files with 9 additions and 3 deletions

View File

@@ -63,7 +63,7 @@ then
echo "Make sure the ESP is connected with a data USB cable, and try again."
exit 1
fi
esptool.py erase_flash &&
# esptool.py erase_flash &&
git pull &&
cd factory &&
cargo espflash flash --release --port $PORT &&

View File

@@ -10,6 +10,7 @@ default = ["std"]
no_persist = []
pingpong = []
std = ["sphinx-signer"]
tls = []
[dependencies]
hex = "0.4.3"

View File

@@ -24,16 +24,21 @@ pub fn make_client(
tx: mpsc::Sender<CoreEvent>,
) -> Result<EspMqttClient<ConnState<MessageImpl, EspError>>> {
log::info!("make_client with id {}", client_id);
let conf = MqttClientConfiguration {
let mut conf = MqttClientConfiguration {
client_id: Some(client_id),
buffer_size: 4096,
task_stack: 12288,
username: Some(username),
password: Some(password),
crt_bundle_attach: Some(esp_idf_sys::esp_crt_bundle_attach),
// crt_bundle_attach: Some(esp_idf_sys::esp_crt_bundle_attach),
..Default::default()
};
#[cfg(feature = "tls")]
{
conf.crt_bundle_attach = Some(esp_idf_sys::esp_crt_bundle_attach);
}
let mut mqtturl = broker.to_string();
if !(mqtturl.starts_with("mqtt://") || mqtturl.starts_with("mqtts://")) {
let scheme = if mqtturl.contains("8883") {