fix: respect env vars and settings.json for DATA_DIR resolution (#1344)
SettingsDefaultsManager.get() returned only the hardcoded default, ignoring both environment variables and settings.json overrides. This meant CLAUDE_MEM_DATA_DIR set via env or settings file had no effect on paths.ts (and other callers using get()). Two changes: - get() now checks process.env before falling back to the default - paths.ts resolves DATA_DIR with full priority: env var > settings.json at the default location > hardcoded default The settings file read uses a synchronous bootstrap pattern to avoid circular dependencies (DATA_DIR is needed to locate the settings file, so we check the default path only). Fixes #1303 Signed-off-by: umut-polat <52835619+umut-polat@users.noreply.github.com>
This commit is contained in:
@@ -133,10 +133,15 @@ export class SettingsDefaultsManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a default value from defaults (no environment variable override)
|
||||
* Get a setting value with environment variable override.
|
||||
* Priority: process.env > hardcoded default
|
||||
*
|
||||
* For full priority (env > settings file > default), use loadFromFile().
|
||||
* This method is safe to call at module-load time (no file I/O) and still
|
||||
* respects environment variable overrides that were previously ignored.
|
||||
*/
|
||||
static get(key: keyof SettingsDefaults): string {
|
||||
return this.DEFAULTS[key];
|
||||
return process.env[key] ?? this.DEFAULTS[key];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user