Skip to content

Commit 2e67d77

Browse files
factorydroidFactory Bot
authored andcommitted
fix(engine): use uppercase CORTEX_HOME env var in find_cortex_home
Fixes bounty issue #1581 The find_cortex_home() function was checking for 'cortex_HOME' (mixed case) instead of 'CORTEX_HOME' (all uppercase), causing the CORTEX_HOME environment variable to be silently ignored. Users setting CORTEX_HOME would find that Cortex still used the default ~/.cortex directory.
1 parent ee89f3c commit 2e67d77

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

cortex-engine/src/config/loader.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,25 +31,25 @@ pub const CORTEX_CONFIG_DIR_ENV: &str = "CORTEX_CONFIG_DIR";
3131
/// Find the Cortex home directory.
3232
///
3333
/// Checks in order:
34-
/// 1. `cortex_CONFIG_DIR` environment variable
35-
/// 2. `cortex_HOME` environment variable
34+
/// 1. `CORTEX_CONFIG_DIR` environment variable
35+
/// 2. `CORTEX_HOME` environment variable
3636
/// 3. Default `~/.cortex` directory
3737
pub fn find_cortex_home() -> std::io::Result<PathBuf> {
38-
// Check cortex_CONFIG_DIR environment variable first (new)
38+
// Check CORTEX_CONFIG_DIR environment variable first (new)
3939
if let Ok(val) = std::env::var(CORTEX_CONFIG_DIR_ENV)
4040
&& !val.is_empty()
4141
{
4242
let path = PathBuf::from(&val);
43-
debug!(path = %path.display(), "Using cortex_CONFIG_DIR");
43+
debug!(path = %path.display(), "Using CORTEX_CONFIG_DIR");
4444
return Ok(path);
4545
}
4646

47-
// Check cortex_HOME environment variable
48-
if let Ok(val) = std::env::var("cortex_HOME")
47+
// Check CORTEX_HOME environment variable
48+
if let Ok(val) = std::env::var("CORTEX_HOME")
4949
&& !val.is_empty()
5050
{
5151
let path = PathBuf::from(&val);
52-
debug!(path = %path.display(), "Using cortex_HOME");
52+
debug!(path = %path.display(), "Using CORTEX_HOME");
5353
return Ok(path);
5454
}
5555

0 commit comments

Comments
 (0)