Skip to content

Commit

Permalink
horizon: Properly check against the HA array being empty (#4152)
Browse files Browse the repository at this point in the history
Because of the way strings.Split works, the returned array will
*always* have at least one element. If the string is empty, the
array will be [""], so we need to check [1] == "" instead of
checking a length of zero.
  • Loading branch information
Shaptic authored Jan 24, 2022
1 parent df312f4 commit 8652df7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion services/horizon/internal/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ func ApplyFlags(config *Config, flags support.ConfigOptions, options ApplyOption

// config.HistoryArchiveURLs contains a single empty value when empty so using
// viper.GetString is easier.
if len(config.HistoryArchiveURLs) == 0 {
if len(config.HistoryArchiveURLs) == 1 && config.HistoryArchiveURLs[0] == "" {
return fmt.Errorf("--history-archive-urls must be set when --ingest is set")
}

Expand Down

0 comments on commit 8652df7

Please sign in to comment.