Skip to content

Improve usage of config files, and encourage it for Keycloak tokens - #240

Open
gernot-h wants to merge 6 commits into
mainfrom
config-file-path-and-docs
Open

gernot-h wants to merge 6 commits into
mainfrom
config-file-path-and-docs

Conversation

@gernot-h

@gernot-h gernot-h commented Sep 8, 2026

Copy link
Copy Markdown
Collaborator

With the last release, handling of Keycloak client_id and client_secret was added which requires special care to avoid leaking these long-lived tokens. I think using the config file is the best solution here, so I tried to document this feature better and also added a corresponding warning if the user passes keycloak tokens on the commandline.

So far, CaPyCli only supported config files in current dir, but for
credentials etc., having one central config file in your home dir would
be better.
Replace lengthy if chain with lookup dict CONFIG_KEY_ALIASES.

Note this also removes the "oa" alias as I don't expect anyone to use
short commandline options in the config file.
…eters

In the config file, we expect internal argument names which in some
cases deviate from the commandline options, so provide aliases in all
such cases.
@gernot-h
gernot-h force-pushed the config-file-path-and-docs branch from 18e2090 to d645eda Compare September 8, 2026 09:07
@gernot-h

gernot-h commented Sep 8, 2026

Copy link
Copy Markdown
Collaborator Author

Discussed with @t-graf and he has another perspective on the config file, mostly using it for per-project settings like e.g. name and paths for reports.

In that case, there's a major risk that such files are pushed to VCS together with other code changes, probably making env variables a better place to store credentials.

So the clear recommendation for storing credentials in files is only valid if config file is used for credentials and stored in $HOME. Having the per-project use case would however need config setting merging...

@gernot-h
gernot-h force-pushed the config-file-path-and-docs branch from fce6a10 to dd66bcc Compare September 16, 2026 09:16
@gernot-h
gernot-h marked this pull request as ready for review September 16, 2026 09:17
@gernot-h

Copy link
Copy Markdown
Collaborator Author

@t-graf, I just pushed an updated version which now also discusses the risks of tokens in a config file and recommends to either use the environment variables for client_secret or a specifically a config file in your home directory.

Following the discussion in #245, I now also added a NOTE clarifying that CaPyCli will automatically request read or write tokens as needed from keycloak.

@brandon1024

Copy link
Copy Markdown

Had a read through the docs here, very clear and well written 👍 Thanks for this Gernot.

The unconventional mixed lowercast/uppercase environment variable naming feels a bit strange if I'm honest, but that's not a problem with the documentation, just an observation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants