Switched from toml to yaml for configuration
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
@@ -39,7 +39,6 @@ pub trait DeviceConfig {
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[serde(tag = "type")]
|
||||
#[enum_dispatch(DeviceConfig)]
|
||||
pub enum DeviceConfigs {
|
||||
AirFilter(AirFilterConfig),
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user