You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
Note that I have [default] for the default profile. Our docs 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].
The text was updated successfully, but these errors were encountered:
It's possible to do this kind of thing by specifying the config paths in the Client constructor, or via env vars:
Setting environment variables PYODK_CONFIG_FILE and PYODK_CACHE_FILE
Init arguments: Client(config_path="my_config.toml", cache_path="my_cache.toml").
So for 3 different servers the calls might look like: Client(config_path="pyodk_default_config.toml", cache_path="pyodk_default_cache.toml") Client(config_path="pyodk_demo_config.toml", cache_path="pyodk_demo_cache.toml") Client(config_path="pyodk_test_config.toml", cache_path="pyodk_test_cache.toml")
Using separate files somewhat reduces the risk of accidentally copying credentials to somewhere they shouldn't be, and allows use of file system access controls with automation (e.g. script A user can see conf A files).
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 callClient(profile="demo")
to use the demo url/user/pass andClient(profile="test")
to use the test profile.Note that I have
[default]
for the default profile. Our docs 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]
.The text was updated successfully, but these errors were encountered: