yin1999 commented on code in PR #317:
URL: https://github.com/apache/dubbo-kubernetes/pull/317#discussion_r1721570096
##########
app/dubboctl/cmd/build.go:
##########
@@ -198,19 +198,23 @@ func (c *buildConfig) Configure(f *dubbo.Dubbo) {
f.Image = c.Image
}
- var envs []dubbo.Env
- for _, pair := range c.Envs {
- parts := strings.Split(pair, "=")
-
- if len(parts) == 2 {
- key := &parts[0]
- value := &parts[1]
- env := dubbo.Env{
- Name: key,
- Value: value,
+ if len(c.Envs) > 0 {
+ envs := map[string]string{}
+ for _, env := range f.Build.BuildEnvs {
+ envs[*env.Name] = *env.Value
+ }
+ for _, pair := range c.Envs {
+ parts := strings.Split(pair, "=")
+ if len(parts) == 2 {
+ envs[parts[0]] = parts[1]
}
- envs = append(envs, env)
+ }
+ f.Build.BuildEnvs = make([]dubbo.Env, 0, len(envs))
+ for k, v := range envs {
+ f.Build.BuildEnvs = append(f.Build.BuildEnvs, dubbo.Env{
+ Name: &k,
+ Value: &v,
+ })
}
}
- f.Build.BuildEnvs = envs
Review Comment:
The `buildEnvs` configured in `dubbo.yaml` would be shadowed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]