Switched from toml to yaml for configuration
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
2023-11-05 22:41:48 +01:00
parent b12b76bd50
commit dd4be4a2ee
14 changed files with 346 additions and 325 deletions

View File

@@ -26,7 +26,6 @@ pub struct Config {
pub fullfillment: FullfillmentConfig,
pub ntfy: Option<NtfyConfig>,
pub presence: PresenceConfig,
#[serde(rename = "device")]
pub devices: IndexMap<String, DeviceConfigs>,
}
@@ -137,7 +136,7 @@ impl Config {
missing.has_missing()?;
let config: Config = toml::from_str(&file)?;
let config: Config = serde_yaml::from_str(&file)?;
Ok(config)
}

View File

@@ -39,7 +39,6 @@ pub trait DeviceConfig {
}
#[derive(Debug, Deserialize)]
#[serde(tag = "type")]
#[enum_dispatch(DeviceConfig)]
pub enum DeviceConfigs {
AirFilter(AirFilterConfig),

View File

@@ -71,7 +71,7 @@ pub enum ConfigParseError {
#[error(transparent)]
IoError(#[from] std::io::Error),
#[error(transparent)]
DeserializeError(#[from] toml::de::Error),
YamlError(#[from] serde_yaml::Error),
}
// TODO: Would be nice to somehow get the line number of the expected wildcard topic

View File

@@ -50,7 +50,7 @@ async fn app() -> anyhow::Result<()> {
info!("Starting automation_rs...");
let config_filename =
std::env::var("AUTOMATION_CONFIG").unwrap_or("./config/config.toml".into());
std::env::var("AUTOMATION_CONFIG").unwrap_or("./config/config.yml".into());
let config = Config::parse_file(&config_filename)?;
// Create a mqtt client