pub struct RuntimoConfig {
pub allowed_paths: Vec<String>,
}Expand description
Runtimo persistent configuration.
Fields§
§allowed_paths: Vec<String>Additional allowed path prefixes (merged with defaults + env var).
Implementations§
Source§impl RuntimoConfig
impl RuntimoConfig
Sourcepub fn config_path() -> PathBuf
pub fn config_path() -> PathBuf
Returns the config file path following XDG spec.
Uses XDG_CONFIG_HOME if set, otherwise ~/.config/runtimo/config.toml.
Falls back to /tmp/runtimo/config.toml with a stderr warning when
neither XDG_CONFIG_HOME nor HOME is set. Configuration in /tmp
is not persistent across reboots.
Sourcepub fn load() -> Self
pub fn load() -> Self
Loads config from disk, returning defaults if the file doesn’t exist or is invalid.
Logs a warning to stderr when the file exists but cannot be read or parsed.
Prefer [load_result] for new code — it propagates errors so callers can
distinguish “file doesn’t exist” from “file is corrupt.”
Sourcepub fn load_result() -> Result<Self, String>
pub fn load_result() -> Result<Self, String>
Loads config from disk, propagating read and parse errors.
§Input
Reads from the path returned by [config_path] if it exists.
§Output
Ok(RuntimoConfig) — Successfully deserialized config, or default if file doesn’t exist.
§Errors
Returns Err(String) when the config file:
- Exists but cannot be opened (permission denied, filesystem error)
- Can be opened but contains invalid TOML syntax
- Contains TOML that deserializes to a different type (schema mismatch)
Returns Ok(Self::default()) when:
- The config file does not exist (first run / clean install)
- The config file is empty (no config needed)
Sourcepub fn save(&self) -> Result<(), String>
pub fn save(&self) -> Result<(), String>
Saves config to disk, creating parent directories as needed.
§Errors
Returns an error if parent directories cannot be created or if the config file cannot be serialized/written to disk.
Sourcepub fn get_allowed_prefixes() -> Vec<String>
pub fn get_allowed_prefixes() -> Vec<String>
Returns merged prefixes: defaults + env var + config file.
Priority (lowest to highest):
- Built-in defaults
RUNTIMO_ALLOWED_PATHSenv var- Config file
allowed_paths
Trait Implementations§
Source§impl Clone for RuntimoConfig
impl Clone for RuntimoConfig
Source§fn clone(&self) -> RuntimoConfig
fn clone(&self) -> RuntimoConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more