Skip to content

Commit

Permalink
Make changes to refactored code
Browse files Browse the repository at this point in the history
  • Loading branch information
tejal29 authored Sep 10, 2020
1 parent ef22155 commit d08e704
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions pkg/skaffold/util/env_template.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,16 @@ func ExecuteEnvTemplate(envTemplate *template.Template, customMap map[string]str
}

// EvaluateEnvTemplateMap parses and executes all map values as templates based on OS environment variables
func EvaluateEnvTemplateMap(args map[string]*string) (map[string]*string, error) {
// An additional envMap can optionally be specified.
// If multiple additional envMaps are specified, all but the first one will be ignored
func EvaluateEnvTemplateMap(args map[string]*string, envMap ...map[string]string) (map[string]*string, error) {
if args == nil {
return nil, nil
}
var env map[string]string
if len(envMap) > 0 {
env = envMap[0]
}

evaluated := map[string]*string{}
for k, v := range args {
Expand All @@ -79,7 +85,7 @@ func EvaluateEnvTemplateMap(args map[string]*string) (map[string]*string, error)
continue
}

value, err := ExpandEnvTemplate(*v, nil)
value, err := util.ExpandEnvTemplate(*v, env)
if err != nil {
return nil, fmt.Errorf("unable to get value for key %q: %w", k, err)
}
Expand Down

0 comments on commit d08e704

Please sign in to comment.