Add support for multiple servers in config
- Dominant language
- Python
- Stars
- 39
- Forks
- 26
- Avg merge
- 22h 46m
- Merged PRs (30d)
- 1
Description
I work with lots of different servers and it's a pain to constantly edit ` .pyodk_config.toml`. I'd love to be able to switch profiles on the fly.
Given this `.pyodk_config.toml`, I'd like to be able to call `Client(profile="demo")` to use the demo url/user/pass and `Client(profile="test")` to use the test profile.
```
[demo]
base_url = "https://demo.getodk.cloud"
username = "alice"
password = "bob"
[default]
base_url = "https://www.example.com"
username = "my_user"
password = "my_password"
default_project_id = 123
[test]
base_url = "https://test.getodk.cloud"
username = "foo"
password = "bar"
```
Note that I have `[default]` for the default profile. Our [docs](https://github.com/getodk/pyodk?tab=readme-ov-file#configure) for the single server config currently uses `[central]`, so maybe if there is only one profile, that is the default regardless of what the header is. If there are two or more, then the default needs to be called `[default]`. Then we can update the docs to use `[default]`.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start at the Client(profile=...) entry point and the existing .pyodk_config.toml configuration described in the Configure docs. Check how the current single-profile [central] setup is loaded, then define profile selection and the [default] fallback for multi-profile configs while preserving existing behavior. Done means demo and test profiles can be selected and the docs use [default].
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- developer-experience
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100