提交 32bf4d46 编写于 作者: M Medya Gh

add unique

上级 80d1c874
......@@ -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
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册