Skip to content

Commit

Permalink
Fixed issue with write command.
Browse files Browse the repository at this point in the history
  • Loading branch information
kristofferahl committed Jan 13, 2024
1 parent b8d9f77 commit 0d0cfc6
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions internal/command/write.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,16 +161,18 @@ func Write(metadata config.AppMetadata) *cli.Command {
}

val := p.Value()
if val == nil {
return false, fmt.Errorf("no value resolved for property %s", p.Name)
}

// NOTE: We should not return error for invalid value at this point, it will stop us writing the initial value
if err := p.Validate(val); err != nil {
ctx.Log.Warnf("property %s, defined in %s, resolved to invalid value from %s, value: %s", p.Name, p.Source(), val.Source(), val.String())
if val != nil {
ctx.Log.Warnf("property %s, defined in %s, resolved to invalid value from %s, value: %s", p.Name, p.Source(), val.Source(), val.String())
}
} else {
ctx.Log.Infof("property %s, defined in %s, resolved to value from %s, value: %s", p.Name, p.Source(), val.Source(), val.String())
if val != nil {
ctx.Log.Infof("property %s, defined in %s, resolved to value from %s, value: %s", p.Name, p.Source(), val.Source(), val.String())
}
}

for _, v := range p.Values() {
if err := p.Validate(v); err != nil {
ctx.Log.Infof("- value from %s is invalid, err: %v", v.Source(), err)
Expand Down

0 comments on commit 0d0cfc6

Please sign in to comment.