chore: switch from yaml to toml
This commit is contained in:
parent
ed493cff29
commit
8d07a86fc4
7 changed files with 66 additions and 32 deletions
|
|
@ -27,7 +27,7 @@ impl Settings {
|
|||
|
||||
if config_path.exists() {
|
||||
let content = fs::read_to_string(&config_path)?;
|
||||
let settings: Settings = serde_yaml::from_str(&content)?;
|
||||
let settings: Settings = toml::from_str(&content)?;
|
||||
Ok(settings)
|
||||
} else {
|
||||
Ok(Settings::default())
|
||||
|
|
@ -36,9 +36,9 @@ impl Settings {
|
|||
|
||||
fn config_path() -> PathBuf {
|
||||
if let Some(proj_dirs) = ProjectDirs::from("", "", "streamd") {
|
||||
proj_dirs.config_dir().join("config.yaml")
|
||||
proj_dirs.config_dir().join("config.toml")
|
||||
} else {
|
||||
PathBuf::from("~/.config/streamd/config.yaml")
|
||||
PathBuf::from("~/.config/streamd/config.toml")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@ pub enum StreamdError {
|
|||
#[error("IO error: {0}")]
|
||||
IoError(#[from] std::io::Error),
|
||||
|
||||
#[error("YAML error: {0}")]
|
||||
YamlError(#[from] serde_yaml::Error),
|
||||
#[error("TOML error: {0}")]
|
||||
TomlError(#[from] toml::de::Error),
|
||||
}
|
||||
|
||||
impl From<StreamdError> for miette::Report {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue