Skip to content

Commit

Permalink
fix: fill interpolated_value with the parent value for alias
Browse files Browse the repository at this point in the history
  • Loading branch information
pggb25 committed Jun 28, 2024
1 parent 60f5e2b commit 291e78e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pkg/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
)

func GetCurrentVersion() string {
return "0.94.16" // ci-version-check
return "0.94.17" // ci-version-check
}

func GetLatestOnlineVersionUrl() (string, error) {
Expand Down
14 changes: 11 additions & 3 deletions utils/env_var.go
Original file line number Diff line number Diff line change
Expand Up @@ -406,11 +406,19 @@ func insertAtIndex(src string, insert string, index int) string {
return string(newRunes)
}

func getInterpolatedValue(value *string, variables []EnvVarLineOutput) *string {
func getInterpolatedValue(value *string, variables []EnvVarLineOutput, aliasParentKey *string) *string {
if value == nil {
return nil
}

if aliasParentKey != nil {
for _, x := range variables {
if *aliasParentKey == x.Key {
return x.Value
}
}
}

if !strings.Contains(*value, "{{") {
return value
}
Expand Down Expand Up @@ -468,7 +476,7 @@ FirstLoop:
}

if strings.Contains(finalValue, "{{") && finalValue != *value {
return getInterpolatedValue(&finalValue, variables)
return getInterpolatedValue(&finalValue, variables, nil)
}

return &finalValue
Expand All @@ -494,7 +502,7 @@ func GetEnvVarJsonOutput(variables []EnvVarLineOutput) string {
"updated_at": ToIso8601(v.UpdatedAt),
"key": v.Key,
"value": v.Value,
"interpolated_value": getInterpolatedValue(v.Value, variables),
"interpolated_value": getInterpolatedValue(v.Value, variables, v.AliasParentKey),
"service_name": v.Service,
"scope": v.Scope,
"alias_parent_key": v.AliasParentKey,
Expand Down

0 comments on commit 291e78e

Please sign in to comment.