[RFC] Persist settings in a file or environment
- Dominant language
- Python
- Stars
- 10
- Forks
- 16
- PR merge metrics
- No merged PRs in 30d
Description
Right now the current version of galaxykit requires passing credentials and server URL as argument.
As a user I want to provide my settings in settings file following something like the [XDG based spec](https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html)
Examples:
when running `$ galaxykit` at the time of instantiation of a new `GalaxyClient` it will look for the existence of the following configuration files, in the exact order.
```bash
./galaxykit.cfg # current working directory or $XDG_RUNTIME_DIR
~/home/user/.galaxykit.cfg # $HOME/.file.cfg
~/home/user/.config/galaxykit.cfg # $XDG_CONFIG_HOME/file.cfg
~/home/user/.config/galaxykit/config.cfg # $XDG_CONFIG_HOME/dir/file.cfg
/etc/galaxykit/config.cfg
```
On the open desktop spec those directories are defined by `$HOME` and `$XDG_CONFIG_HOME` and it is a common pattern to follow it.
It will load data from multiple files, but don't override existing values.
Any of the config keys can be overwritten by export `GALAXYKIT_` prefixed environment variable.
## proposals
- Implement the XDG file lookup internally to keep the low dependency design **recommended**
- Use python-xdg lib
- Use a settings library such as dynaconf or pydantic
- reuse ansible.cfg (is that an option?)
Contributor guide
No contributing guide indexed for this repository
Research direction
Start at the GalaxyClient instantiation and trace how credentials and the server URL are currently supplied. The issue proposes several configuration approaches but selects no implementation; completion would require an agreed design covering the listed file lookup order, non-overriding file loads, and GALAXYKIT_ environment-variable overrides.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli, tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100