refactor(config)!: Setup for expanding lua config return

Moves the application config out of automation_lib and sets up the
config return type for further expansion.
This commit is contained in:
2025-10-17 02:41:03 +02:00
parent a95574b731
commit ba818c6b60
4 changed files with 43 additions and 40 deletions

View File

@@ -1,4 +1,3 @@
use std::net::{Ipv4Addr, SocketAddr};
use std::time::Duration;
use lua_typed::Typed;
@@ -30,29 +29,6 @@ impl From<MqttConfig> for MqttOptions {
}
}
#[derive(Debug, Deserialize)]
pub struct FulfillmentConfig {
pub openid_url: String,
#[serde(default = "default_fulfillment_ip")]
pub ip: Ipv4Addr,
#[serde(default = "default_fulfillment_port")]
pub port: u16,
}
impl From<FulfillmentConfig> for SocketAddr {
fn from(fulfillment: FulfillmentConfig) -> Self {
(fulfillment.ip, fulfillment.port).into()
}
}
fn default_fulfillment_ip() -> Ipv4Addr {
[0, 0, 0, 0].into()
}
fn default_fulfillment_port() -> u16 {
7878
}
#[derive(Debug, Clone, Deserialize, Typed)]
pub struct InfoConfig {
pub name: String,