-
Notifications
You must be signed in to change notification settings - Fork 2
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
token timer cache: support multiple vault servers #61
Conversation
This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation. |
@pschulten switching between different VAULT_ADDR seems to work in general. But when you revoke the token of a session, it still shows the remaining time even though the token should be considered expired immediately. Not sure if this a bug, a cache issue or a missing feature :-)
|
@tillkuhn it's by design. The main use-case for the timer (at least for me) is to render it into the shell prompt. N 119m timer-cache vaultpal ❯ declare -f _ss_precmd
_ss_precmd ()
{
export PRE_PROMPT=$(vaultpal timer; _kube_prompt);
case $(vaultpal timer -q) in
green)
export STARSHIP_CONFIG=~/.config/starship.toml
;;
yellow)
export STARSHIP_CONFIG=~/.config/starship.yellow.toml
;;
red)
STARSHIP_CONFIG=~/.config/starship.red.toml
;;
*)
unset STARSHIP_CONFIG
;;
esac
}
If you do that, you want to have maximum performance, hence the cache to avoid the network round-trip. Users are supposed to reset the cache themselves on anything related to token manipulation. e.g. N 117m timer-cache vaultpal ❯ declare -f get_token
get_token ()
{
t=$(vaultpal timer -q);
case $t in
yellow | red)
vault token renew -increment 2h > /dev/null 2>&1;
vaultpal timer --clear-cache
;;
green)
;;
*)
vault login -method oidc > /dev/null 2>&1;
vault token renew -increment 2h > /dev/null 2>&1;
vaultpal timer --clear-cache
;;
esac
} If you like, I can give you a demo :) |
No description provided.