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:
vhaudiquet committed 2026-10-29 22:45:04 +01:00
1 parent 12148ac951
commit 006fce632b
4 files changed
+6 -54

No files matched your search

-2
View File
@@ -343,8 +343,6 @@ tool.
└── <...>.provisioned # hot-cell marker
```
`~/.config/ecrou.yaml` carries over (DNS overrides today).
## Snap packaging
Confinement: strict. Plugs: `network`, `home`, `kvm`. Manual
-43
View File
@@ -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()],
})
}
}
}
}
-1
View File
@@ -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;
+6 -8
View File
@@ -27,7 +27,6 @@ description: |
## Configuration and cache
- image cache: `~/snap/ecrou/common/cache/ecrou`
- config: `~/snap/ecrou/common/config/ecrou.yaml`
The home interface does not cover dotfiles, so the XDG
directories are redirected into the snap's common data area.
@@ -58,17 +57,16 @@ parts:
build-packages: [cmake, perl]
override-build: |
craftctl default
# The home interface stops at dotfiles, so ~/.cache and
# ~/.config are unreachable under strict confinement. Point the
# XDG lookups (the dirs crate honors these variables) into the
# snap's durable area, shared across refreshes.
# The home interface stops at dotfiles, so ~/.cache is
# unreachable under strict confinement. Point the XDG cache
# lookup (the dirs crate honors the variable) into the snap's
# durable area, shared across refreshes.
mkdir -p "$CRAFT_PART_INSTALL/command-chain"
cat > "$CRAFT_PART_INSTALL/command-chain/ecrou-env" <<'EOF'
#!/bin/sh
XDG_CACHE_HOME="$SNAP_USER_COMMON/cache"
XDG_CONFIG_HOME="$SNAP_USER_COMMON/config"
export XDG_CACHE_HOME XDG_CONFIG_HOME
mkdir -p "$XDG_CACHE_HOME" "$XDG_CONFIG_HOME"
export XDG_CACHE_HOME
mkdir -p "$XDG_CACHE_HOME"
exec "$@"
EOF
chmod 755 "$CRAFT_PART_INSTALL/command-chain/ecrou-env"