-
Notifications
You must be signed in to change notification settings - Fork 66
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
Add PINNIPED_SKIP_PRINT_LOGIN_URL env var to CLI #1897
Conversation
26c7a18
to
a70ce9c
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1897 +/- ##
=======================================
Coverage 38.25% 38.25%
=======================================
Files 347 347
Lines 44200 44207 +7
=======================================
+ Hits 16907 16910 +3
- Misses 26780 26785 +5
+ Partials 513 512 -1 ☔ View full report in Codecov by Sentry. |
Could this be a |
debugEnvVarName = "PINNIPED_DEBUG" | ||
|
||
// The value to use for true/false env vars to enable the behavior caused by the env var. | ||
envVarTruthyValue = "true" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we relax this a bit to allow for True
or TRUE
? The following func
should only return true for a very limited number of values as per https://gosamples.dev/string-to-bool/. We could still document using true
but this allows for variations.
func isTruthyString(s string) bool {
b, err := strconv.ParseBool(s)
return err == nil && b
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can do that if you'd like. I was copying the style used by the existing PINNIPED_DEBUG
env var which is either true
or anything else is considered not true.
It could be a flag. The community member who reported this problem suggested that as a solution. However, I was thinking the same thing that you mentioned about the same kubeconfig being used for both purposes, which is why I thought maybe it should be an env var. If a user wanted to hardcode this value into their kubeconfig, they can still do so, because you can put env var names and values into the kubeconfig (see https://kubernetes.io/docs/reference/access-authn-authz/authentication/#configuration). |
The approach taken in #1874 to attempt to solve #1868 did not work as well as I had hoped.
This PR removes some of the code from #1874 and replaces it with a new env var used by the CLI called
PINNIPED_SKIP_PRINT_LOGIN_URL
, which causes the CLI to skip printing the login URL to stderr when the env car is set totrue
and when the browser was opened to the login URL.For example, you could use
PINNIPED_SKIP_PRINT_LOGIN_URL=true k9s --kubeconfig pinniped-browser-flow-kubeconfig.yaml
to start k9s.Release note: