Skip to content

Commit

Permalink
ARO-3536: Add error handling when "CLUSTER" env variable is empty. (#…
Browse files Browse the repository at this point in the history
…3007)

* ARO-3536: Add error handling when "CLUSTER" env variable is empty.
* ARO-3536: Include empty string validation
* ARO-3536: Refactor variable names and include variable name in error message.
  • Loading branch information
edisonLcardenas authored Jul 24, 2023
1 parent 861bdb9 commit d14ee24
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pkg/env/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,9 @@ func IsCI() bool {
// if it does not exist an environment variable with that name, it will return an error.
// Otherwise it returns nil.
func ValidateVars(vars ...string) error {
for _, v := range vars {
if _, found := os.LookupEnv(v); !found {
return fmt.Errorf("environment variable %q unset", v)
for _, envName := range vars {
if envValue, found := os.LookupEnv(envName); !found || envValue == "" {
return fmt.Errorf("environment variable %q unset", envName)
}
}
return nil
Expand Down

0 comments on commit d14ee24

Please sign in to comment.