custom CLI directory for detee-api

specify a custom path for the CLI directory using the `DETEE_API_USER_PATH` environment variable.
This commit is contained in:
Noor 2025-07-15 19:31:51 +05:30
parent 006817161d
commit 617b5cba43
Signed by: noormohammedb
GPG Key ID: D83EFB8B3B967146

@ -187,7 +187,9 @@ impl Config {
} }
pub fn cli_dir_path() -> Result<String, Error> { pub fn cli_dir_path() -> Result<String, Error> {
let dir = Self::home_dir() + ("/.detee/cli"); let dir = std::env::var("DETEE_API_USER_PATH")
.unwrap_or_else(|_| Self::home_dir() + ("/.detee/cli"));
if !Path::new(&dir).exists() { if !Path::new(&dir).exists() {
warn!("Could not config dir. Creating {dir}"); warn!("Could not config dir. Creating {dir}");
std::fs::create_dir_all(dir.clone())?; std::fs::create_dir_all(dir.clone())?;