-
Notifications
You must be signed in to change notification settings - Fork 144
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
fix(venom): env variables with equal sign #721
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.
Hi @bramca , thank you for your proposal.
Can you add a unit test about that into https://github.com/ovh/venom/blob/master/cmd/venom/run/cmd_test.go#L92 please?
Signed-off-by: Bram.Cautaerts <bram.cautaerts@ing.com>
Signed-off-by: Bram.Cautaerts <bram.cautaerts@ing.com>
Added a unit test for it |
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 think that SplitN is more readable than strings.Join..[1:].., '='
cmd/venom/run/cmd.go
Outdated
@@ -289,7 +289,7 @@ func initFromEnv(environ []string) ([]string, error) { | |||
if strings.HasPrefix(env, "VENOM_VAR_") { | |||
tuple := strings.Split(env, "=") |
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.
tuple := strings.Split(env, "=") | |
tuple := strings.SplitN(a, "=", 2) |
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.
agreed, good suggestion
Signed-off-by: Bram.Cautaerts <bram.cautaerts@ing.com>
LGTM, thank you |
This PR fixes the following issue:
VENOM_VAR_a='host=localhost'
results in a='host' because of the split on '=' and only taking the first value back
With this the var would end up like this:
a = 'host=localhost'
Making it possible to add equal signs in the variable