Skip to content

Commit

Permalink
Simplify logic
Browse files Browse the repository at this point in the history
  • Loading branch information
bsardo committed May 21, 2021
1 parent deb79a3 commit bf8918d
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -473,8 +473,8 @@ func (cfg *TimeoutNotification) validate(errs []error) []error {

// New uses viper to get our server configurations.
func New(v *viper.Viper) (*Configuration, error) {
if errs := validateRequired(v); len(errs) > 0 {
return nil, errortypes.NewAggregateError("validation errors", errs)
if !v.IsSet("gdpr.default_value") {
return nil, fmt.Errorf("Required config flag gdpr.default_value not specified")
}

var c Configuration
Expand Down Expand Up @@ -1050,11 +1050,3 @@ func isValidCookieSize(maxCookieSize int) error {
}
return nil
}

func validateRequired(v *viper.Viper) []error {
errs := make([]error, 0)
if !v.IsSet("gdpr.default_value") {
errs = append(errs, fmt.Errorf("Required config flag gdpr.default_value not specified"))
}
return errs
}

0 comments on commit bf8918d

Please sign in to comment.