feat: support RDT_CONFIG_DIR and XDG_CONFIG_HOME for config path override#6
Open
cestivan wants to merge 1 commit intopublic-clis:mainfrom
Open
feat: support RDT_CONFIG_DIR and XDG_CONFIG_HOME for config path override#6cestivan wants to merge 1 commit intopublic-clis:mainfrom
cestivan wants to merge 1 commit intopublic-clis:mainfrom
Conversation
…ride Fixes the hardcoded config path (~/.config/rdt-cli) by resolving the config directory using the following priority: 1. RDT_CONFIG_DIR env var — explicit full path override; useful for multi-user/multi-agent environments where each instance must have isolated credentials and must not share config with others. 2. XDG_CONFIG_HOME/rdt-cli — standard XDG Base Directory spec, already expected by users on Linux and macOS. 3. ~/.config/rdt-cli — existing default, unchanged as final fallback. No breaking change: behaviour is identical when neither env var is set. Also updates README to document the two new environment variables and links the authentication section to the env vars table.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The config directory is currently hardcoded to
~/.config/rdt-cli:This causes two issues:
XDG_CONFIG_HOME.Solution
Resolve the config directory using a priority chain with no breaking change:
RDT_CONFIG_DIRenv varRDT_CONFIG_DIR=/tmp/myagent/rdtrdt whoamiXDG_CONFIG_HOME/rdt-cliXDG_CONFIG_HOME=~/.config-workrdt whoami~/.config/rdt-cliThe implementation is a small helper function in
constants.py:Changes
rdt_cli/constants.py— introduce_resolve_config_dir(), replace the hardcoded pathREADME.md— documentRDT_CONFIG_DIRandXDG_CONFIG_HOMEin the Environment Variables table; link the Authentication section to itBackwards compatibility
No breaking change. When neither env var is set, the resolved path is identical to the previous hardcoded value.