From 19a4440e7f73c4bcd5f2d459e242239e26aa49ec Mon Sep 17 00:00:00 2001 From: Stanislaw Grams Date: Fri, 13 Feb 2026 08:30:27 +0100 Subject: [PATCH] [feat](trx-client): add home directory config search path Add ~/.trx-client.toml to the config file search paths, making it easy for users to place their config in the home directory. Updated search order: 1. Path specified via --config CLI argument 2. ./trx-client.toml (current directory) 3. ~/.trx-client.toml (home directory) [NEW] 4. ~/.config/trx-rs/client.toml (XDG config) 5. /etc/trx-rs/client.toml (system-wide) This provides a more standard Unix convention for user config files. Co-Authored-By: Claude Opus 4.6 Signed-off-by: Stanislaw Grams --- src/trx-client/src/config.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/trx-client/src/config.rs b/src/trx-client/src/config.rs index cc54b2e..1ef1766 100644 --- a/src/trx-client/src/config.rs +++ b/src/trx-client/src/config.rs @@ -7,8 +7,9 @@ //! Supports loading configuration from TOML files with the following search order: //! 1. Path specified via `--config` CLI argument //! 2. `./trx-client.toml` (current directory) -//! 3. `~/.config/trx-rs/client.toml` (XDG config) -//! 4. `/etc/trx-rs/client.toml` (system-wide) +//! 3. `~/.trx-client.toml` (home directory) +//! 4. `~/.config/trx-rs/client.toml` (XDG config) +//! 5. `/etc/trx-rs/client.toml` (system-wide) use std::net::IpAddr; use std::path::{Path, PathBuf}; @@ -452,6 +453,9 @@ impl ConfigFile for ClientConfig { fn default_search_paths() -> Vec { let mut paths = Vec::new(); paths.push(PathBuf::from("trx-client.toml")); + if let Some(home_dir) = dirs::home_dir() { + paths.push(home_dir.join(".trx-client.toml")); + } if let Some(config_dir) = dirs::config_dir() { paths.push(config_dir.join("trx-rs").join("client.toml")); }