-
Notifications
You must be signed in to change notification settings - Fork 49
Support loading client config file from XDG_CONFIG_HOME #253
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: python-3
Are you sure you want to change the base?
Conversation
No functional changes yet: this is pure code motion. Signed-off-by: Stephen Finucane <[email protected]>
Otherwise, this fails when we later attempt to access the file. Signed-off-by: Stephen Finucane <[email protected]>
Signed-off-by: Stephen Finucane <[email protected]>
if user_config_file: | ||
if not os.path.exists(user_config_file): | ||
sys.stderr.write( | ||
"File at '%s' indicated by BEAKER_CLIENT_CONF does not exist" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
%s
parameter here is not used
|
||
# ~/.beaker | ||
user_config_file = os.path.expanduser('~/.beaker') | ||
if os.path.exists(user_config_file): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
better to check isfile
instead of exists
as it's passed to load_from_file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR updates client configuration loading to follow XDG_CONFIG_HOME standards and deprecates legacy config paths, while also addressing a bug where BEAKER_CLIENT_CONF points to an unavailable file.
- Introduces get_user_config_file to prioritize configuration from BEAKER_CLIENT_CONF, then XDG, and finally legacy paths with deprecation warnings.
- Adds get_system_config_file to load the system-wide configuration file.
- Adjusts initialization to use the updated configuration look-up functions.
Comments suppressed due to low confidence (1)
Client/src/bkr/client/init.py:29
- [nitpick] Consider appending a newline to the error message for improved readability.
File at '%s' indicated by BEAKER_CLIENT_CONF does not exist
It's a standard, and it stop us littering our home directory with yet another config file :)
A small bug is addressed where the path indicated by
BEAKER_CLIENT_CONF
does not exist is also addressed.