-
Notifications
You must be signed in to change notification settings - Fork 59
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
Enable env var hints for --token
#945
Enable env var hints for --token
#945
Conversation
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.
👋🏻 @andersjanmyr thanks for opening this PR!
Implementation looks OK, I just have a few requests.
pkg/app/run.go
Outdated
envVarCache = []string{} | ||
for _, e := range os.Environ() { | ||
pair := strings.SplitN(e, "=", 2) | ||
envVarCache = append(envVarCache, fmt.Sprintf("\\$%s", pair[0])) |
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.
I have concerns about Windows support, it would be good to see a test implemented for the env
package that validates the logic will work for Windows users. Our CI runs the CLI test suite on all three major platforms: macOS, Linux and Windows so if the test passes on all three then we'll know the implementation is good.
Example: set some environment variables and see if this function returns back the expected list of variables.
On Windows, I believe, the way to reference an environment variable is %VAR_NAME%
so I presume os.Environ()
will normalize the output so it works across platforms.
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.
Yes, it probably needs some special treatment to handle Windows.
@andersjanmyr out of interest, is there a reason you're using this approach rather than something like |
@Integralist I was thinking of using profile locally, but we're using the same script to deploy both locally and on CI.
|
45199e1
to
0ed90f8
Compare
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.
Other than two minor change requests this looks good to me.
Thanks!
Moved envVars to env.Vars Add test case for env.Vars Add slices package for slices.Contains Actually test something sensible Check error value from Setenv since windows does not set values Test with common variables instead Mark tests on other platforms as skip Document Vars method
0ed90f8
to
efda6dc
Compare
Example: