mirror of
https://github.com/vhaudiquet/ecrou.git
synced 2026-11-12 22:22:44 +00:00
refactor(config): remove the unwired config module
Config::load was never called: the DNS-override story it carried contradicts the actual resolver flow, and nothing in the CLI or snap advertised a key. Delete the module and every mention of the ecrou.yaml file in SPEC and the snap; the XDG_CONFIG_HOME redirect in the command chain served only that file.
This commit is contained in:
1 parent
12148ac951
commit
006fce632b
4 files changed
+6
-54
No files matched your search
@@ -1,43 +0,0 @@
|
||||
use anyhow::Context;
|
||||
|
||||
use crate::Result;
|
||||
use serde::Deserialize;
|
||||
|
||||
#[derive(Debug, Deserialize, Default)]
|
||||
pub struct Config {
|
||||
#[serde(default)]
|
||||
pub dns: Vec<String>,
|
||||
}
|
||||
|
||||
impl Config {
|
||||
pub fn load() -> Result<Self> {
|
||||
let config_path = dirs::config_dir().map(|p| p.join("ecrou.yaml"));
|
||||
|
||||
match config_path {
|
||||
Some(path) if path.exists() => {
|
||||
let content =
|
||||
std::fs::read_to_string(&path).context("Failed to read config file")?;
|
||||
|
||||
let config: Config =
|
||||
serde_yaml::from_str(&content).context("Failed to parse config file")?;
|
||||
|
||||
// Set defaults
|
||||
let config = Config {
|
||||
dns: if config.dns.is_empty() {
|
||||
vec!["1.1.1.1".to_string()]
|
||||
} else {
|
||||
config.dns
|
||||
},
|
||||
};
|
||||
|
||||
Ok(config)
|
||||
}
|
||||
_ => {
|
||||
// No config file, use defaults
|
||||
Ok(Config {
|
||||
dns: vec!["1.1.1.1".to_string()],
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -31,7 +31,6 @@
|
||||
//! embeds the library exactly the way the CLI does - a [`RootfsCache`]
|
||||
//! to prepare a rootfs, then [`run`] to boot it.
|
||||
|
||||
pub mod config;
|
||||
pub mod distro;
|
||||
pub mod download;
|
||||
pub mod error;
|
||||
|
||||
Reference in new issue
Block a user