Remove ability to have duplicates in environment variables

Signed-off-by: Matt Farina <matt@mattfarina.com>
pull/6353/head
Matt Farina 5 years ago
parent ec31f13ee9
commit 378b9dd29e
No known key found for this signature in database
GPG Key ID: 9436E80BFBA46909

@ -55,8 +55,8 @@ type envOptions struct {
}
func (o *envOptions) run(out io.Writer) error {
for _, e := range o.settings.EnvironmentVariables {
fmt.Printf("%s=\"%s\" \n", e.Name, e.Value)
for k, v := range o.settings.EnvironmentVariables {
fmt.Printf("%s=\"%s\" \n", k, v)
}
return nil
}

@ -52,13 +52,8 @@ type EnvSettings struct {
// PluginsDirectory is the path to the plugins directory.
PluginsDirectory string
// Environment Variables Store
EnvironmentVariables []EnvironmentVariable
}
type EnvironmentVariable struct {
Name string
Value string
// Environment Variables Store.
EnvironmentVariables map[string]string
}
func New() *EnvSettings {
@ -67,7 +62,7 @@ func New() *EnvSettings {
RegistryConfig: helmpath.ConfigPath("registry.json"),
RepositoryConfig: helmpath.ConfigPath("repositories.yaml"),
RepositoryCache: helmpath.CachePath("repository"),
EnvironmentVariables: []EnvironmentVariable{},
EnvironmentVariables: make(map[string]string),
}
envSettings.setHelmEnvVars()
return &envSettings
@ -118,11 +113,7 @@ func (s *EnvSettings) setHelmEnvVars() {
if eVal := os.Getenv(key); len(eVal) > 0 {
val = eVal
}
s.EnvironmentVariables = append(s.EnvironmentVariables,
EnvironmentVariable{
Name: key,
Value: val,
})
s.EnvironmentVariables[key] = val
}
}

Loading…
Cancel
Save