Skip to content

Add --config-dir and --data-dir global CLI flags to override default paths#1907

Merged
dgageot merged 1 commit into
docker:mainfrom
dgageot:override-global-paths
Mar 3, 2026
Merged

Add --config-dir and --data-dir global CLI flags to override default paths#1907
dgageot merged 1 commit into
docker:mainfrom
dgageot:override-global-paths

Conversation

@dgageot
Copy link
Copy Markdown
Member

@dgageot dgageot commented Mar 3, 2026

Add SetCacheDir, SetConfigDir, and SetDataDir to the paths package, allowing callers to override the default ~/.cache/cagent, ~/.config/cagent and ~/.cagent directories at runtime.

Three new persistent flags are wired in the root command:
--cache-dir overrides ~/.cache/cagent
--config-dir overrides ~/.config/cagent
--data-dir overrides ~/.cagent

Assisted-By: cagent

…paths

Add SetCacheDir, SetConfigDir, and SetDataDir to the paths package,
allowing callers to override the default ~/.config/cagent and ~/.cagent
directories at runtime. The getters check for an override (protected by
a RWMutex) before falling back to the platform-specific defaults.

Two new persistent flags are wired in the root command:
  --config-dir  overrides ~/.config/cagent
  --data-dir    overrides ~/.cagent

These are applied in PersistentPreRunE before logging and telemetry
initialization so all downstream consumers honour the overrides. This
is useful when running cagent inside a sandbox where the home directory
is not writable or mapped to a non-standard location.

Assisted-By: cagent
@dgageot dgageot requested a review from a team as a code owner March 3, 2026 17:55
@dgageot dgageot merged commit 5302781 into docker:main Mar 3, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants