Skip to content

Commit

Permalink
Revert "Refactor to simplify region validation"
Browse files Browse the repository at this point in the history
This reverts commit 333e75a.
  • Loading branch information
antfie committed Oct 30, 2023
1 parent 333e75a commit 3ce906c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func main() {

flag.Parse()

if !utils.IsValidRegion(*region) {
if *region != "" && utils.IsValidRegion(*region) == false {
utils.ErrorAndExitWithUsage(fmt.Sprintf("Invalid region \"%s\". Must be either \"commercial\", \"us\" or \"european\"", *region))
}

Expand Down
8 changes: 3 additions & 5 deletions utils/platform_url.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,9 @@ func ParseBaseUrlFromRegion(region string) string {
}

func IsValidRegion(region string) bool {
if len(region) > 0 {
for _, regionData := range regions {
if regionData.ID == region {
return true
}
for _, regionData := range regions {
if regionData.ID == region {
return true
}
}
return false
Expand Down

0 comments on commit 3ce906c

Please sign in to comment.