add unique
parent
80d1c8741d
commit
32bf4d46a7
|
@ -341,7 +341,7 @@ func generateClusterConfig(cmd *cobra.Command, existing *config.ClusterConfig, k
|
|||
|
||||
// Feed Docker our host proxy environment by default, so that it can pull images
|
||||
// doing this for both new config and existing, in case proxy changed since previous start
|
||||
if _, ok := r.(*cruntime.Docker); ok && !cmd.Flags().Changed("docker-env") {
|
||||
if _, ok := r.(*cruntime.Docker); ok {
|
||||
proxy.SetDockerEnv()
|
||||
}
|
||||
|
||||
|
|
|
@ -168,5 +168,17 @@ func SetDockerEnv() []string {
|
|||
config.DockerEnv = append(config.DockerEnv, fmt.Sprintf("%s=%s", k, v))
|
||||
}
|
||||
}
|
||||
|
||||
// remove duplicates
|
||||
seen := map[string]bool{}
|
||||
uniqueEnvs := []string{}
|
||||
for e := range config.DockerEnv {
|
||||
if !seen[config.DockerEnv[e]] {
|
||||
seen[config.DockerEnv[e]] = true
|
||||
uniqueEnvs = append(uniqueEnvs, config.DockerEnv[e])
|
||||
}
|
||||
}
|
||||
config.DockerEnv = uniqueEnvs
|
||||
|
||||
return config.DockerEnv
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue