Skip to content

Commit

Permalink
Add boolean validation for tanzu config set feature flags
Browse files Browse the repository at this point in the history
  • Loading branch information
mpanchajanya committed Feb 27, 2024
1 parent 96e0ba0 commit fae2b15
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/command/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,9 @@ func setConfiguration(pathParam, value string) error {
if len(paramArray) != 3 {
return errors.New("unable to parse config path parameter into three parts [" + strings.Join(paramArray, ".") + "] (was expecting 'features.<plugin>.<feature>'")
}
if value != "true" && value != "false" {

Check failure on line 148 in pkg/command/config.go

View workflow job for this annotation

GitHub Actions / Build

string `true` has 2 occurrences, make it a constant (goconst)
return errors.New("invalid value provided only boolean true or false are accepted")
}
return configlib.SetFeature(paramArray[1], paramArray[2], value)
case ConfigLiteralEnv:
if len(paramArray) != 2 {
Expand Down

0 comments on commit fae2b15

Please sign in to comment.