rename meshtastic hostname config to address
All checks were successful
/ build-container (push) Successful in 6m23s

This commit is contained in:
Finn 2024-10-17 22:46:29 -07:00
parent 853da3974c
commit 4f5b878606
3 changed files with 6 additions and 6 deletions

View file

@ -23,7 +23,7 @@ impl Bridge {
// setup meshtastic connection
let stream_api = StreamApi::new();
let tcp_stream = utils::stream::build_tcp_stream(config.meshtastic.hostname).await?;
let tcp_stream = utils::stream::build_tcp_stream(config.meshtastic.address).await?;
let (meshtastic_listener, meshtastic_stream_api) = stream_api.connect(tcp_stream).await;
// setup matrix client

View file

@ -20,8 +20,8 @@ pub(crate) struct MatrixConfig {
#[derive(serde::Deserialize, Debug)]
pub(crate) struct MeshtasticConfig {
#[serde(default = "get_meshtastic_hostname")]
pub(crate) hostname: String,
#[serde(default = "get_meshtastic_address")]
pub(crate) address: String, // expected format is host:port
}
fn get_device_name() -> String {
@ -39,8 +39,8 @@ fn get_matrix_password() -> String {
}
}
fn get_meshtastic_hostname() -> String {
match std::env::var("MESHTASTIC_HOSTNAME") {
fn get_meshtastic_address() -> String {
match std::env::var("MESHTASTIC_ADDRESS") {
Ok(p) => p,
Err(_) => "meshtastic.local".to_string(),
}

View file

@ -19,7 +19,7 @@ pub(crate) async fn build(
) -> Result<MeshtasticClient, Box<dyn std::error::Error>> {
let stream_api = StreamApi::new();
let tcp_stream = utils::stream::build_tcp_stream(config.hostname).await?;
let tcp_stream = utils::stream::build_tcp_stream(config.address).await?;
let (decoded_listener, stream_api) = stream_api.connect(tcp_stream).await;
log::info!("connected to meshtastic device");