Skip to content

armgit / xerj

Public Imported from GitHub
0

AI search engine and MCP server for bots and agents. One Rust binary indexes code, docs, logs, JSONL/CSV and PDFs for BM25 full-text, vector and hybrid search, code search without grep, agent memory and RAG. Elasticsearch-compatible API; Corpus Hub serves hundreds of reference memory corpora.

fix(server): resolve home via xerj_common::home::home_dir

xerj-orgba28276ff5db
diff --git a/engine/crates/xerj-server/src/brain.rs b/engine/crates/xerj-server/src/brain.rs
index 60da9dbe9..3331f56d0 100644
--- a/engine/crates/xerj-server/src/brain.rs
+++ b/engine/crates/xerj-server/src/brain.rs
@@ -160,8 +160,10 @@ fn parse(args: Vec<String>) -> Result<Option<BrainCfg>, String> {
}
fn default_data_dir() -> PathBuf {
- let home = std::env::var("HOME").unwrap_or_else(|_| "/tmp".into());
- Path::new(&home).join(".xerj").join("brain")
+ xerj_common::home::home_dir()
+ .unwrap_or_else(|| PathBuf::from("/tmp"))
+ .join(".xerj")
+ .join("brain")
}
/// (host, port) out of an `http://host[:port]` URL. Only plain-http local
diff --git a/engine/crates/xerj-server/src/share.rs b/engine/crates/xerj-server/src/share.rs
index 829f5ee21..e919dac58 100644
--- a/engine/crates/xerj-server/src/share.rs
+++ b/engine/crates/xerj-server/src/share.rs
@@ -655,15 +655,17 @@ fn find_cloudflared() -> Option<PathBuf> {
let mut dirs: Vec<PathBuf> = std::env::var_os("PATH")
.map(|p| std::env::split_paths(&p).collect())
.unwrap_or_default();
- if let Some(home) = std::env::var_os("HOME") {
- dirs.push(Path::new(&home).join(".local").join("bin"));
+ if let Some(home) = xerj_common::home::home_dir() {
+ dirs.push(home.join(".local").join("bin"));
}
dirs.into_iter().map(|d| d.join(exe)).find(|p| p.is_file())
}
fn default_data_dir() -> PathBuf {
- let home = std::env::var("HOME").unwrap_or_else(|_| "/tmp".into());
- Path::new(&home).join(".xerj").join("brain")
+ xerj_common::home::home_dir()
+ .unwrap_or_else(|| PathBuf::from("/tmp"))
+ .join(".xerj")
+ .join("brain")
}
/// `--api-key` / `XERJ_API_KEY` first, then `<data-dir>/admin.key` — the same