feat: add IRONCLAW_BASE_DIR env var with LazyLock caching (#397)

This commit is contained in:
ibhagwan
2026-02-27 17:43:43 +04:00
committed by GitHub
parent a7c0be7f1b
commit c592a8f2de
26 changed files with 255 additions and 127 deletions
+4 -8
View File
@@ -7,6 +7,8 @@ use std::path::PathBuf;
use serde::{Deserialize, Serialize};
use crate::bootstrap::ironclaw_base_dir;
/// User settings persisted to disk.
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
pub struct Settings {
@@ -656,10 +658,7 @@ impl Settings {
/// Get the default settings file path (~/.ironclaw/settings.json).
pub fn default_path() -> std::path::PathBuf {
dirs::home_dir()
.unwrap_or_else(|| std::path::PathBuf::from("."))
.join(".ironclaw")
.join("settings.json")
ironclaw_base_dir().join("settings.json")
}
/// Load settings from disk, returning default if not found.
@@ -677,10 +676,7 @@ impl Settings {
/// Default TOML config file path (~/.ironclaw/config.toml).
pub fn default_toml_path() -> PathBuf {
dirs::home_dir()
.unwrap_or_else(|| PathBuf::from("."))
.join(".ironclaw")
.join("config.toml")
ironclaw_base_dir().join("config.toml")
}
/// Load settings from a TOML file.